pointrb 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +16 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +40 -26
- data/README.md +1 -86
- data/Rakefile +5 -0
- data/TODO.md +35 -1
- data/bin/pointrb +35 -0
- data/cucumber.yml +3 -0
- data/features/create_layout.feature +96 -0
- data/features/create_new_project.feature +29 -0
- data/features/pointrb_setup.feature +22 -0
- data/features/step_definitions.rb +96 -0
- data/features/support/env.rb +26 -0
- data/features/support/helper.rb +62 -0
- data/features/test.feature +0 -0
- data/gemfiles/Gemfile.default +2 -1
- data/lib/bob_the_helper/command/command_result.rb +12 -0
- data/lib/bob_the_helper/command.rb +49 -0
- data/lib/bob_the_helper/environment.rb +27 -0
- data/lib/bob_the_helper/file_system/exceptions.rb +11 -0
- data/lib/bob_the_helper/file_system.rb +245 -0
- data/lib/bob_the_helper.rb +5 -0
- data/lib/pointrb/actions/check_if_pointrb_has_already_been_initialized.rb +15 -0
- data/lib/pointrb/actions/check_project_path.rb +15 -0
- data/lib/pointrb/actions/create_layout.rb +16 -0
- data/lib/pointrb/actions/create_project_wrapper.rb +15 -0
- data/lib/pointrb/actions/determine_layout_directory.rb +14 -0
- data/lib/pointrb/actions/error_handler_commandline.rb +39 -0
- data/lib/pointrb/actions/initialize_pointrb.rb +15 -0
- data/lib/pointrb/actions/retrieve_layout_files.rb +16 -0
- data/lib/pointrb/actions/retrieve_parsed_layout.rb +17 -0
- data/lib/pointrb/actions/set_project_name.rb +15 -0
- data/lib/pointrb/actions/show_pointrb_version.rb +14 -0
- data/lib/pointrb/api.rb +36 -0
- data/lib/pointrb/directory.rb +25 -0
- data/lib/pointrb/exceptions.rb +22 -0
- data/lib/pointrb/layout.rb +16 -0
- data/lib/pointrb/layout_constructor.rb +58 -0
- data/lib/pointrb/layout_file.rb +24 -0
- data/lib/pointrb/layout_manager.rb +32 -0
- data/lib/pointrb/layout_storage_manager.rb +40 -0
- data/lib/pointrb/layout_tree.rb +45 -0
- data/lib/pointrb/pointrb_file.rb +33 -0
- data/lib/pointrb/project.rb +11 -0
- data/lib/pointrb/version.rb +1 -1
- data/lib/pointrb.rb +32 -0
- data/pointrb.gemspec +3 -2
- data/script/terminal +1 -0
- data/spec/bob_the_helper/command/command_spec.rb +55 -0
- data/spec/bob_the_helper/environment/environment_spec.rb +15 -0
- data/spec/bob_the_helper/file_system/file_system_spec.rb +279 -0
- data/spec/directory/directory_spec.rb +30 -0
- data/spec/hooks.rb +5 -0
- data/spec/layout/layout_spec.rb +20 -0
- data/spec/layout_constructor/layout_constructor_spec.rb +122 -0
- data/spec/layout_file/layout_file_spec.rb +49 -0
- data/spec/layout_manager/layout_manager_spec.rb +47 -0
- data/spec/layout_storage_manager/layout_storage_manager_spec.rb +58 -0
- data/spec/layout_tree/layout_tree_spec.rb +70 -0
- data/spec/pointrb_file/pointrb_file_spec.rb +34 -0
- data/spec/project/project_spec.rb +19 -0
- data/spec/spec_helper.rb +9 -13
- data/spec/support/capture.rb +19 -0
- data/spec/support/env.rb +0 -0
- data/spec/support/helper.rb +8 -0
- data/spec/support/hooks.rb +5 -0
- metadata +104 -5
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--order rand
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,25 +2,27 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
pointrb (0.0.1)
|
5
|
-
|
5
|
+
activesupport
|
6
6
|
middleware
|
7
|
+
rubytree
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: http://rubygems.org/
|
10
11
|
specs:
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
activesupport (3.2.12)
|
13
|
+
i18n (~> 0.6)
|
14
|
+
multi_json (~> 1.0)
|
14
15
|
arrayfields (4.7.4)
|
15
16
|
aruba (0.5.1)
|
16
17
|
childprocess (~> 0.3.6)
|
17
18
|
cucumber (>= 1.1.1)
|
18
19
|
rspec-expectations (>= 2.7.0)
|
19
20
|
awesome_print (1.1.0)
|
20
|
-
|
21
|
-
|
21
|
+
bond (0.4.3)
|
22
|
+
builder (3.2.0)
|
23
|
+
childprocess (0.3.9)
|
22
24
|
ffi (~> 1.0, >= 1.0.11)
|
23
|
-
chronic (0.9.
|
25
|
+
chronic (0.9.1)
|
24
26
|
churn (0.0.28)
|
25
27
|
chronic (>= 0.2.3)
|
26
28
|
hirb
|
@@ -30,19 +32,22 @@ GEM
|
|
30
32
|
sexp_processor (~> 4.1)
|
31
33
|
coderay (1.0.9)
|
32
34
|
columnize (0.3.6)
|
33
|
-
cucumber (1.2.
|
35
|
+
cucumber (1.2.3)
|
34
36
|
builder (>= 2.1.2)
|
35
37
|
diff-lcs (>= 1.1.3)
|
36
|
-
gherkin (~> 2.11.
|
37
|
-
|
38
|
-
debugger (1.
|
38
|
+
gherkin (~> 2.11.6)
|
39
|
+
multi_json (~> 1.3)
|
40
|
+
debugger (1.4.0)
|
39
41
|
columnize (>= 0.3.1)
|
40
42
|
debugger-linecache (~> 1.1.1)
|
41
|
-
debugger-ruby_core_source (~> 1.
|
43
|
+
debugger-ruby_core_source (~> 1.2.0)
|
44
|
+
debugger-completion (1.0.0)
|
45
|
+
bond (>= 0.4.2)
|
46
|
+
debugger (~> 1.1)
|
42
47
|
debugger-linecache (1.1.2)
|
43
48
|
debugger-ruby_core_source (>= 1.1.1)
|
44
|
-
debugger-ruby_core_source (1.
|
45
|
-
diff-lcs (1.1
|
49
|
+
debugger-ruby_core_source (1.2.0)
|
50
|
+
diff-lcs (1.2.1)
|
46
51
|
fattr (2.2.1)
|
47
52
|
ffaker (1.15.0)
|
48
53
|
ffi (1.4.0)
|
@@ -55,9 +60,10 @@ GEM
|
|
55
60
|
github-markup (0.7.5)
|
56
61
|
hashr (0.0.22)
|
57
62
|
hirb (0.7.1)
|
63
|
+
i18n (0.6.4)
|
58
64
|
json (1.7.7)
|
59
65
|
json_pure (1.7.7)
|
60
|
-
main (5.
|
66
|
+
main (5.2.0)
|
61
67
|
arrayfields (>= 4.7.4)
|
62
68
|
chronic (>= 0.6.2)
|
63
69
|
fattr (>= 2.2.0)
|
@@ -70,50 +76,58 @@ GEM
|
|
70
76
|
coderay (~> 1.0.5)
|
71
77
|
method_source (~> 0.8)
|
72
78
|
slop (~> 3.4)
|
79
|
+
pry-debugger (0.2.2)
|
80
|
+
debugger (~> 1.3)
|
81
|
+
pry (~> 0.9.10)
|
73
82
|
pry-doc (0.4.4)
|
74
83
|
pry (>= 0.9.9.6)
|
75
84
|
yard (~> 0.8.1)
|
76
85
|
rake (10.0.3)
|
77
86
|
redcarpet (2.2.2)
|
78
|
-
rspec (2.
|
79
|
-
rspec-core (~> 2.
|
80
|
-
rspec-expectations (~> 2.
|
81
|
-
rspec-mocks (~> 2.
|
82
|
-
rspec-core (2.
|
83
|
-
rspec-expectations (2.
|
84
|
-
diff-lcs (
|
87
|
+
rspec (2.13.0)
|
88
|
+
rspec-core (~> 2.13.0)
|
89
|
+
rspec-expectations (~> 2.13.0)
|
90
|
+
rspec-mocks (~> 2.13.0)
|
91
|
+
rspec-core (2.13.1)
|
92
|
+
rspec-expectations (2.13.0)
|
93
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
85
94
|
rspec-instafail (0.2.4)
|
86
|
-
rspec-mocks (2.
|
95
|
+
rspec-mocks (2.13.0)
|
87
96
|
ruby-progressbar (1.0.2)
|
88
97
|
ruby_parser (3.1.1)
|
89
98
|
sexp_processor (~> 4.1)
|
99
|
+
rubytree (0.8.3)
|
100
|
+
json (>= 1.7.5)
|
101
|
+
structured_warnings (>= 0.1.3)
|
90
102
|
sexp_processor (4.1.5)
|
91
103
|
simplecov (0.7.1)
|
92
104
|
multi_json (~> 1.0)
|
93
105
|
simplecov-html (~> 0.7.1)
|
94
106
|
simplecov-html (0.7.1)
|
95
|
-
slop (3.4.
|
107
|
+
slop (3.4.4)
|
108
|
+
structured_warnings (0.1.3)
|
96
109
|
thor (0.17.0)
|
97
110
|
tmrb (1.2.7)
|
98
111
|
thor
|
99
112
|
travis-lint (1.6.0)
|
100
113
|
hashr (~> 0.0.22)
|
101
|
-
yard (0.8.
|
114
|
+
yard (0.8.5.2)
|
102
115
|
|
103
116
|
PLATFORMS
|
104
117
|
ruby
|
105
118
|
|
106
119
|
DEPENDENCIES
|
107
|
-
activesupport
|
108
120
|
aruba
|
109
121
|
awesome_print
|
110
122
|
churn
|
111
123
|
debugger
|
124
|
+
debugger-completion
|
112
125
|
ffaker
|
113
126
|
fuubar
|
114
127
|
github-markup
|
115
128
|
pointrb!
|
116
129
|
pry
|
130
|
+
pry-debugger
|
117
131
|
pry-doc
|
118
132
|
rake
|
119
133
|
redcarpet
|
data/README.md
CHANGED
@@ -20,100 +20,15 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
Currently the following strategies are supported
|
24
|
-
<table>
|
25
|
-
<tr>
|
26
|
-
<th>Strategy</th>
|
27
|
-
<th>Description</th>
|
28
|
-
</tr>
|
29
|
-
<tr>
|
30
|
-
<td>:contains_all</td>
|
31
|
-
<td>True if all of the given keywords are part of the data</td>
|
32
|
-
</tr>
|
33
|
-
<tr>
|
34
|
-
<td>:contains_any</td>
|
35
|
-
<td>True if any of the given keywords are part of the data</td>
|
36
|
-
</tr>
|
37
|
-
<tr>
|
38
|
-
<td>:not_contains</td>
|
39
|
-
<td>True if the given keywords are not part of the data</td>
|
40
|
-
</tr>
|
41
|
-
<tr>
|
42
|
-
<td>:contains_all_as_substring</td>
|
43
|
-
<td>True if all given keywords are a substring of an data element</td>
|
44
|
-
</tr>
|
45
|
-
<tr>
|
46
|
-
<td>:contains_any_as_substring</td>
|
47
|
-
<td>True if any given keyword are a substring of an data element</td>
|
48
|
-
</tr>
|
49
|
-
<tr>
|
50
|
-
<td>:not_contains_substring</td>
|
51
|
-
<td>True if none of the given keywords is a substring of an data element</td>
|
52
|
-
</tr>
|
53
|
-
<tr>
|
54
|
-
<td>:is_equal</td>
|
55
|
-
<td>True if both, the keywords and the data, are identical</td>
|
56
|
-
</tr>
|
57
|
-
<tr>
|
58
|
-
<td>:is_not_equal</td>
|
59
|
-
<td>True if the keywords are didfferent from the data</td>
|
60
|
-
</tr>
|
61
|
-
</table>
|
62
23
|
|
63
24
|
### Simple example
|
64
25
|
|
65
|
-
```ruby
|
66
|
-
require 'the_array_comparator'
|
67
|
-
comparator = TheArrayComparator::Comparator.new
|
68
|
-
data = %w{ a b c d }
|
69
|
-
keyword_overlap = %w{ a b }
|
70
|
-
|
71
|
-
comparator.add_check data , :contains_all , keyword_overlap
|
72
|
-
|
73
|
-
result = comparator.success?
|
74
|
-
puts result #should be true
|
75
|
-
```
|
76
|
-
|
77
|
-
### Example with substrings
|
78
|
-
|
79
|
-
```ruby
|
80
|
-
require 'the_array_comparator'
|
81
|
-
comparator = TheArrayComparator::Comparator.new
|
82
|
-
data = %w{ acd b }
|
83
|
-
keyword_overlap = %w{ cd b }
|
84
|
-
|
85
|
-
comparator.add_check data , :contains_all_as_substring, keyword_overlap
|
86
|
-
|
87
|
-
result = comparator.success?
|
88
|
-
puts result #should be true
|
89
|
-
```
|
90
|
-
|
91
|
-
### Example with exceptions
|
92
|
-
|
93
|
-
```ruby
|
94
|
-
require 'the_array_comparator'
|
95
|
-
comparator = TheArrayComparator::Comparator.new
|
96
|
-
data = %w{ acd b }
|
97
|
-
keyword_overlap = %w{ a b }
|
98
|
-
exceptions = %w{ cd }
|
99
|
-
|
100
|
-
comparator.add_check data , :contains_all_as_substring, keyword_overlap, exceptions
|
101
|
-
|
102
|
-
result = comparator.success?
|
103
|
-
puts result #should be false
|
104
|
-
```
|
105
26
|
|
106
27
|
### Extend the library
|
107
28
|
|
108
|
-
If you wish to write your own comparators you can do so. Just register those classes with a keyword.
|
109
|
-
|
110
|
-
```ruby
|
111
|
-
TheArrayComparator::Comparator.register :my_contains, Strategies::MyContains
|
112
|
-
```
|
113
|
-
|
114
29
|
## Further reading
|
115
30
|
|
116
|
-
Please the the full api-documentation on [rdoc info](http://rdoc.info/github/maxmeyer/
|
31
|
+
Please the the full api-documentation on [rdoc info](http://rdoc.info/github/maxmeyer/pointrb) for further reading.
|
117
32
|
I just give you a brief overview of all the available methods. There's also a brief [guide](API-GUIDE.md) about howto discover the API.
|
118
33
|
|
119
34
|
## Contributing
|
data/Rakefile
CHANGED
data/TODO.md
CHANGED
@@ -1,2 +1,36 @@
|
|
1
|
-
|
1
|
+
# Features
|
2
|
+
* Create directory structure
|
3
|
+
* Support dry run
|
4
|
+
* Check for existing files
|
5
|
+
* Support file fetcher
|
6
|
+
* git
|
7
|
+
* scp
|
8
|
+
* local file
|
9
|
+
* DSL
|
10
|
+
* Create file (with support for file content in dsl)
|
11
|
+
* Create directory
|
12
|
+
* View created directory structure as tree
|
13
|
+
* Setting file system permissions for files (file, executable)
|
14
|
+
* List available layouts
|
15
|
+
* Implode pointrb
|
16
|
+
* Output license and copyright
|
17
|
+
* Force initialize
|
18
|
+
* Add some default templates
|
2
19
|
|
20
|
+
# Internals
|
21
|
+
* Use middleware pattern to make library easy to extend
|
22
|
+
* ParseOptions
|
23
|
+
* ParseDSL
|
24
|
+
|
25
|
+
Build array of Files and Directories
|
26
|
+
|
27
|
+
* CreateAbstractDirectoryTree
|
28
|
+
|
29
|
+
Split up path to create nodes in directory tree. Leafs nodes are the files to be
|
30
|
+
created. Parent nodes are directories to be created.
|
31
|
+
|
32
|
+
* CheckDirectoryTreeForExistingFiles
|
33
|
+
* CreateObjectsInFileSystem
|
34
|
+
* OutputCreatedDirectoryStructure
|
35
|
+
* DirectoryTree (based on RubyTree)
|
36
|
+
|
data/bin/pointrb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'thor'
|
5
|
+
require 'pointrb'
|
6
|
+
require 'pry'
|
7
|
+
require 'debugger'
|
8
|
+
|
9
|
+
class Default < Thor
|
10
|
+
map '--version' => :version
|
11
|
+
|
12
|
+
desc "new <project>", "create directories and files for new project"
|
13
|
+
method_option :verbose, type: :boolean, default: false, aliases: '-v'
|
14
|
+
method_option :layout, type: :string, default: 'default', aliases: '-l'
|
15
|
+
def new(project_name)
|
16
|
+
env = OpenStruct.new
|
17
|
+
env.project_name = project_name
|
18
|
+
env.command_line_options = options
|
19
|
+
|
20
|
+
PointRb::Api.create_layout(env)
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "init", "initialize directory structures in system for use of pointrb"
|
24
|
+
def init
|
25
|
+
env = OpenStruct.new
|
26
|
+
PointRb::Api.initialize_pointrb(env)
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "version", "show version of library"
|
30
|
+
def version
|
31
|
+
PointRb::Api.show_version
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
Default.start
|
data/cucumber.yml
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
Feature: Create layout
|
2
|
+
As a developer
|
3
|
+
I would like to define a layout
|
4
|
+
In order to start a new project
|
5
|
+
|
6
|
+
# @cmd_debug
|
7
|
+
# @cmd_output
|
8
|
+
Scenario: Existing layout
|
9
|
+
Given a layout file named "new_layout.layout" exists with:
|
10
|
+
"""
|
11
|
+
layout :name do
|
12
|
+
end
|
13
|
+
"""
|
14
|
+
When I run `pointrb new new_project --layout name`
|
15
|
+
Then an information occured:
|
16
|
+
"""
|
17
|
+
[Information] Layout 'name' for project 'new_project' created.
|
18
|
+
"""
|
19
|
+
|
20
|
+
Scenario: layout with directory
|
21
|
+
Given a layout file named "new_layout.layout" exists with:
|
22
|
+
"""
|
23
|
+
layout :name do
|
24
|
+
directory 'new_directory'
|
25
|
+
end
|
26
|
+
"""
|
27
|
+
When I run `pointrb new new_project --layout name`
|
28
|
+
Then a directory named 'new_project/new_directory' should exist
|
29
|
+
|
30
|
+
Scenario: layout with nested directory
|
31
|
+
Given a layout file named "new_layout.layout" exists with:
|
32
|
+
"""
|
33
|
+
layout :name do
|
34
|
+
directory 'new_directory' do
|
35
|
+
directory 'subdirectory' do
|
36
|
+
directory 'subdirectory'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
"""
|
41
|
+
When I run `pointrb new new_project --layout name`
|
42
|
+
Then a directory named 'new_project/new_directory' exists with:
|
43
|
+
|Objects |
|
44
|
+
|subdirectory |
|
45
|
+
|subdirectory/subdirectory|
|
46
|
+
|
47
|
+
Scenario: layout with a file
|
48
|
+
Given a layout file named "new_layout.layout" exists with:
|
49
|
+
"""
|
50
|
+
layout :new_layout do
|
51
|
+
file 'new_file' do
|
52
|
+
<<-EOF
|
53
|
+
this is content
|
54
|
+
this is content
|
55
|
+
EOF
|
56
|
+
end
|
57
|
+
end
|
58
|
+
"""
|
59
|
+
When I run `pointrb new new_project --layout new_layout`
|
60
|
+
Then a file named 'new_project/new_file' exists with:
|
61
|
+
"""
|
62
|
+
this is content
|
63
|
+
this is content
|
64
|
+
|
65
|
+
"""
|
66
|
+
|
67
|
+
Scenario: layout with a file which is different from layout name
|
68
|
+
Given a layout file named "new_layout.layout" exists with:
|
69
|
+
"""
|
70
|
+
layout :name do
|
71
|
+
file 'new_file' do
|
72
|
+
<<-EOF
|
73
|
+
this is content
|
74
|
+
this is content
|
75
|
+
EOF
|
76
|
+
end
|
77
|
+
end
|
78
|
+
"""
|
79
|
+
When I run `pointrb new new_project --layout name`
|
80
|
+
Then a file named 'new_project/new_file' exists with:
|
81
|
+
"""
|
82
|
+
this is content
|
83
|
+
this is content
|
84
|
+
|
85
|
+
"""
|
86
|
+
|
87
|
+
Scenario: layout with syntax error
|
88
|
+
Given a layout file named "new_layout.layout" exists with:
|
89
|
+
"""
|
90
|
+
garbage
|
91
|
+
"""
|
92
|
+
When I run `pointrb new new_project --layout name`
|
93
|
+
Then an error occured:
|
94
|
+
"""
|
95
|
+
Syntax error in layout-file
|
96
|
+
"""
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Feature: Create new project
|
2
|
+
|
3
|
+
As a developer
|
4
|
+
I need to create a directory structure
|
5
|
+
In order to start a new project
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given a layout file named "default.layout" exists with:
|
9
|
+
"""
|
10
|
+
layout :default do
|
11
|
+
end
|
12
|
+
"""
|
13
|
+
|
14
|
+
Scenario: Non existing directory
|
15
|
+
Given the directory 'new_project' does not exist
|
16
|
+
When I successfully run `pointrb new new_project`
|
17
|
+
Then a directory named 'new_project' should exist
|
18
|
+
And an information occured:
|
19
|
+
"""
|
20
|
+
[Information] Layout 'default' for project 'new_project' created.
|
21
|
+
"""
|
22
|
+
|
23
|
+
Scenario: Existing directory
|
24
|
+
Given the directory 'new_project' exists
|
25
|
+
When I run `pointrb new new_project`
|
26
|
+
Then an error occured:
|
27
|
+
"""
|
28
|
+
[Error] Directory 'new_project' exists. Exit!
|
29
|
+
"""
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Feature: Setup system for use with pointrb
|
2
|
+
|
3
|
+
As a developer
|
4
|
+
I want all needed files to be placed at the correct place
|
5
|
+
In order to get started with pointrb at rapid speed
|
6
|
+
|
7
|
+
Scenario: Non setup system
|
8
|
+
Given pointrb has never been used on this host
|
9
|
+
When I successfully run `pointrb init`
|
10
|
+
Then a directory named '~/.config/pointrb' exists with:
|
11
|
+
|Objects|
|
12
|
+
|layouts|
|
13
|
+
|
14
|
+
#@cmd_debug
|
15
|
+
# @cmd_output
|
16
|
+
Scenario: System which is already setup
|
17
|
+
Given pointrb has already been used on this host
|
18
|
+
When I run `pointrb init`
|
19
|
+
Then an error occured:
|
20
|
+
"""
|
21
|
+
[Error] This system has already been setup. Exit!
|
22
|
+
"""
|
@@ -0,0 +1,96 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
Before do
|
3
|
+
cleanup_working_directory
|
4
|
+
end
|
5
|
+
|
6
|
+
Before('@cmd_output') do
|
7
|
+
@cmd_output = true
|
8
|
+
end
|
9
|
+
|
10
|
+
Before('@cmd_debug') do
|
11
|
+
@cmd_debug = true
|
12
|
+
end
|
13
|
+
|
14
|
+
Given /^the directory '([^']+)' does not exist$/ do |path|
|
15
|
+
result = path_exists?(path)
|
16
|
+
expect(result).to eq(false)
|
17
|
+
end
|
18
|
+
|
19
|
+
Given /^the directory '([^']+)' exists$/ do |path|
|
20
|
+
create_directory(path)
|
21
|
+
end
|
22
|
+
|
23
|
+
When /^I successfully run `([^`]+)`$/ do |command|
|
24
|
+
@result = run_this_command command
|
25
|
+
|
26
|
+
if @cmd_output == true
|
27
|
+
puts "_stdout_:\n" + @result.stdout unless @result.stdout.blank?
|
28
|
+
puts "_stderr_:\n" + @result.stderr unless @result.stderr.blank?
|
29
|
+
end
|
30
|
+
|
31
|
+
expect(@result.status.success?).to eq(true)
|
32
|
+
end
|
33
|
+
|
34
|
+
Then /^a directory named '([^']+)' should exist$/ do |path|
|
35
|
+
result = path_exists?(path)
|
36
|
+
expect(result).to eq(true)
|
37
|
+
end
|
38
|
+
|
39
|
+
When /^I run `([^`]+)`$/ do |command|
|
40
|
+
@result = run_this_command command
|
41
|
+
|
42
|
+
if @cmd_output == true
|
43
|
+
puts "_stdout_:\n" + @result.stdout unless @result.stdout.blank?
|
44
|
+
puts "_stderr_:\n" + @result.stderr unless @result.stderr.blank?
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
Then /^an error occured:$/ do |string|
|
49
|
+
@result = BobTheHelper::Command::CommandResult.new if @result.blank?
|
50
|
+
|
51
|
+
expect(@result.stderr.chomp[string]).to_not eq(nil)
|
52
|
+
end
|
53
|
+
|
54
|
+
Given /^pointrb has never been used on this host$/ do
|
55
|
+
result = path_does_not_exist? pointrb_config_directories
|
56
|
+
expect(result).to eq(true)
|
57
|
+
end
|
58
|
+
|
59
|
+
Given /^pointrb has already been used on this host$/ do
|
60
|
+
create_directory pointrb_config_directories
|
61
|
+
end
|
62
|
+
|
63
|
+
Then /^a directory named '([^']+)' exists with:$/ do |base_dir,table|
|
64
|
+
directory_entries = table.rows.flatten
|
65
|
+
result = path_exists? directory_entries.map { |e| File.join(base_dir, e) }
|
66
|
+
|
67
|
+
expect(result).to eq(true)
|
68
|
+
end
|
69
|
+
|
70
|
+
Given /^a layout file named "([^"]+)" exists with:$/ do |layout_name, layout_definition|
|
71
|
+
layout_directory = File.join(ENV['HOME'],'.config', 'pointrb', 'layouts')
|
72
|
+
create_directory layout_directory
|
73
|
+
|
74
|
+
layout_file = File.join(layout_directory, layout_name)
|
75
|
+
create_file layout_file, layout_definition
|
76
|
+
end
|
77
|
+
|
78
|
+
Then /^an information occured:$/ do |output|
|
79
|
+
@result = BobTheHelper::Command::CommandResult.new if @result.blank?
|
80
|
+
|
81
|
+
expect(@result.stdout.chomp).to eq(output)
|
82
|
+
end
|
83
|
+
|
84
|
+
Then /^the run is successful$/ do
|
85
|
+
@result = BobTheHelper::Command::CommandResult.new if @result.blank?
|
86
|
+
|
87
|
+
expect(@result.status.success?).to eq(true)
|
88
|
+
end
|
89
|
+
|
90
|
+
Then /^a file named '([^']+)' exists with:$/ do |path,content|
|
91
|
+
exists = path_exists?(path)
|
92
|
+
expect(exists).to eq(true)
|
93
|
+
|
94
|
+
file_content = read_file path
|
95
|
+
expect(file_content).to eq(content)
|
96
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
$LOAD_PATH << File.expand_path('../../lib' , File.dirname(__FILE__))
|
3
|
+
|
4
|
+
unless ENV['TRAVIS_CI'] == 'true'
|
5
|
+
require 'pry'
|
6
|
+
require 'ap'
|
7
|
+
require 'ffaker'
|
8
|
+
require 'benchmark'
|
9
|
+
|
10
|
+
require 'debugger'
|
11
|
+
require 'debugger/completion'
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'stringio'
|
15
|
+
require 'tempfile'
|
16
|
+
|
17
|
+
require 'active_support/core_ext/object/blank'
|
18
|
+
require 'active_support/core_ext/numeric/time'
|
19
|
+
#require 'active_support/core_ext/kernel/reporting'
|
20
|
+
|
21
|
+
unless ENV['TRAVIS_CI'] == 'true'
|
22
|
+
require 'simplecov'
|
23
|
+
SimpleCov.start
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'pointrb'
|