wally 0.0.44 → 0.0.45

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -9,25 +9,28 @@ The product owner or business analyst usually does not want to use an IDE or VCS
9
9
  ## What's wrong with Relish?
10
10
  Many of the ideas have been borrowed from Matt Wynne's Relish product, but we;
11
11
 
12
- ### Didn't want
12
+ ## Didn't want
13
13
  * To sign-in
14
14
 
15
- ### Wanted to
15
+ ## Wanted to
16
16
  * Use it through mobile devices
17
- * Easily group features and scenarios by tags
17
+ * Easily group features and scenarios by tags
18
18
  * Count features and tags
19
19
  * Include a project progress bar (based on tags)
20
20
 
21
- ### Installation
21
+ ## Installation
22
22
  * Install [mongodb](http://www.mongodb.org/display/DOCS/Quickstart "mongodb") and ensure it is running (e.g. '~ $ ./mongodb-xxxxx-xxxx-x.x.x/bin/mongod')
23
- * `gem install wally`
24
- * you might also want mongo_mapper (`gem install mongo_mapper`)
25
-
26
- ### Usage
27
- * create a '.wally' file and enter any authentication text you like (`echo myPassword > .wally`)
28
- * run wally server, in the same dir that you put the .wally file (`wally server`)
29
- * check [http://localhost:4567/](http://localhost:4567/)
30
- * import your features (from local dir) `wally push http://localhost:4567/projects/<project-name> <feature-dir>`
23
+ * ```gem install wally```
24
+ * you might also want mongo_mapper (```gem install mongo_mapper```)
25
+
26
+ ## Usage
27
+ * create a '.wally' file and enter any authentication text you like (```echo myPassword > .wally```)
28
+ * run wally server, in the same dir that you put the .wally file (```wally server```)
29
+ * check [http://localhost:4567/](http://localhost:4567/)
30
+ * import your features (from local dir) ```wally push http://localhost:4567/projects/<project-name> <feature-dir>```
31
+
32
+ ## Deleting projects
33
+ ```wally destroy http://localhost:4567/projects/<project-name>```
31
34
 
32
35
 
33
36
  ## Wally?
data/bin/wally CHANGED
@@ -20,4 +20,7 @@ elsif ARGV[0] == "push"
20
20
  features << {:path => feature_path, :gherkin => gherkin}
21
21
  end
22
22
  RestClient.put "#{ARGV[1]}/features/?authentication_code=#{File.read(".wally")}", features.to_json, {:content_type => :json, :accept => :json}
23
+ elsif ARGV[0] == "destroy"
24
+ require "restclient"
25
+ RestClient.delete ARGV[1]
23
26
  end
@@ -18,3 +18,17 @@ Feature: Push Features To Server
18
18
  When I put data to /my_project_name/features with the authentication code
19
19
  And I visit "my_project_name" page
20
20
  Then I see the uploaded feature
21
+
22
+ Scenario: Delete projects without authorisation
23
+ Given I don't have a .wally authorisation file
24
+ And I create a project called "project1"
25
+ When I send DELETE to "/projects/project1"
26
+ Then "project1" should exist
27
+ And I get a 403 http status
28
+
29
+ Scenario: Delete projects with authorisation
30
+ Given I have a .wally authentication file
31
+ And I create a project called "project1"
32
+ When I send DELETE to "/projects/project1"
33
+ Then "project1" should not exist
34
+ And I get a 201 http status
@@ -25,3 +25,4 @@ Then /^I can switch to the (\d).+ project$/ do |project_number|
25
25
 
26
26
  page.current_url.end_with?(project_number).should be_true
27
27
  end
28
+
@@ -26,6 +26,23 @@ When /^I put data to \/my_project_name\/features with the authentication code$/
26
26
  page.driver.put "/projects/my_project_name/features?authentication_code=#{@authentication_code}", data
27
27
  end
28
28
 
29
+ Given /^I create a project called "([^"]*)"$/ do |project_name|
30
+ project project_name
31
+ Wally::Project.first(:name => project_name).class.should equal Wally::Project
32
+ end
33
+
34
+ When /^I send DELETE to "([^"]*)"$/ do |project_path|
35
+ page.driver.delete "#{project_path}?authentication_code=#{@authentication_code}"
36
+ end
37
+
38
+ Then /^"([^"]*)" should exist$/ do |project_name|
39
+ Wally::Project.first(:name => project_name).class.should equal Wally::Project
40
+ end
41
+
42
+ Then /^"([^"]*)" should not exist$/ do |project_name|
43
+ Wally::Project.first(:name => project_name).class.should_not equal Wally::Project
44
+ end
45
+
29
46
  When /^I visit "([^"]*)" page$/ do |project_name|
30
47
  visit "/projects/#{project_name}"
31
48
  end
@@ -62,19 +62,39 @@ def highlighted_search_result_blurb search_result
62
62
  highlighted
63
63
  end
64
64
 
65
- put '/projects/:project/features/?' do
66
- if File.exist?(".wally") && params[:authentication_code] == File.read(".wally").strip
67
- current_project.delete if current_project
68
- project = Wally::Project.create(:name => params[:project])
65
+ def authenticated?
66
+ File.exist?(".wally") && params[:authentication_code] == File.read(".wally").strip
67
+ end
68
+
69
+ def get_scenario_url(scenario)
70
+ url = "/projects/#{current_project.name}/features/#{scenario["id"].gsub(";", "/scenario/")}"
71
+ end
69
72
 
70
- JSON.parse(request.body.read).each do |json|
71
- project.features << Wally::Feature.new(:path => json["path"], :gherkin => json["gherkin"])
73
+ def get_sorted_scenarios(feature)
74
+ scenarios = []
75
+
76
+ if feature.gherkin["elements"]
77
+ feature.gherkin["elements"].each do |element|
78
+ if element["type"] == "scenario" || element["type"] == "scenario_outline"
79
+ scenarios << element
80
+ end
72
81
  end
73
- project.save
74
- halt 201
75
- else
76
- error 403
77
82
  end
83
+ scenarios.sort! { |a, b| a["name"] <=> b["name"] }
84
+ scenarios
85
+ end
86
+
87
+ put '/projects/:project/features/?' do
88
+ error 403 unless authenticated?
89
+
90
+ current_project.delete if current_project
91
+ project = Wally::Project.create(:name => params[:project])
92
+
93
+ JSON.parse(request.body.read).each do |json|
94
+ project.features << Wally::Feature.new(:path => json["path"], :gherkin => json["gherkin"])
95
+ end
96
+ project.save
97
+ halt 201
78
98
  end
79
99
 
80
100
  get '/?' do
@@ -95,6 +115,13 @@ get '/projects/:project/?' do
95
115
  haml :project
96
116
  end
97
117
 
118
+ delete '/projects/:project' do
119
+ error 403 unless authenticated?
120
+ project = Wally::Project.first(:name => params[:project])
121
+ project.destroy
122
+ halt 201
123
+ end
124
+
98
125
  get '/projects/:project/features/:feature/?' do
99
126
  current_project.features.each do |feature|
100
127
  @feature = feature if feature.gherkin["id"] == params[:feature]
@@ -129,21 +156,3 @@ get '/projects/:project/features/:feature/scenario/:scenario/?' do
129
156
  end
130
157
  haml :scenario
131
158
  end
132
-
133
- def get_scenario_url(scenario)
134
- url = "/projects/#{current_project.name}/features/#{scenario["id"].gsub(";", "/scenario/")}"
135
- end
136
-
137
- def get_sorted_scenarios(feature)
138
- scenarios = []
139
-
140
- if feature.gherkin["elements"]
141
- feature.gherkin["elements"].each do |element|
142
- if element["type"] == "scenario" || element["type"] == "scenario_outline"
143
- scenarios << element
144
- end
145
- end
146
- end
147
- scenarios.sort! { |a, b| a["name"] <=> b["name"] }
148
- scenarios
149
- end
@@ -1,3 +1,3 @@
1
1
  module Wally
2
- VERSION = "0.0.44"
2
+ VERSION = "0.0.45"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wally
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.44
4
+ version: 0.0.45
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: