wally-client 0.0.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05576150bc06cf494969cf47cf9a9031c897111c
4
- data.tar.gz: b8301941cd8b57fea7015511c690c43afd54ecae
3
+ metadata.gz: 4c9fcedd6ebec53724d71e08c2bbd353e834610b
4
+ data.tar.gz: 23d60992f164a9be6b919852d9312952e2b5bfd2
5
5
  SHA512:
6
- metadata.gz: 4561b183e5fef8cbcf915d63c50ab2336bef097d513e87d73c6aa778679253c617bab266a038dcf76bc96afa6ff528d6325809520de36e2ce138104c25a4f608
7
- data.tar.gz: d2d38ce63e63d49764ddea045e04800aabadf0cf446b40906ebe6267df4b312ae8d48c09c9a3aa6a110f8512cfe0d6b0621efa8a94a8b37ad0fc7c6432411586
6
+ metadata.gz: ff2589014dbd999b597aba8ce88cf82c1bd6ac91cfe03a7376ab4f943121b971ece85ad41e834d1130364574a3941d66faa5398079e06061ec8a41ce89816ca0
7
+ data.tar.gz: 26e7a8f30ac58fe55e3b053139d08d0f54beeb9470749d586eea715ce6eabb0215a791000dda8b99541ec1383ef574625bdee43c28cbeb7487cdaf5508a81480
data/.gitignore CHANGED
@@ -5,4 +5,5 @@
5
5
  Gemfile.lock
6
6
  pkg/*
7
7
  .wally
8
+ tmp/
8
9
  chromedriver.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --warnings
2
+ --colour
@@ -0,0 +1,7 @@
1
+ rvm:
2
+ - 1.9.3
3
+ - 2.0.0
4
+ - 2.1.1
5
+ - 2.1.2
6
+ - rbx-2
7
+ script: bundle exec rspec spec
data/bin/wally CHANGED
@@ -1,29 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
3
3
 
4
- if ARGV.first == "push"
5
- require "restclient"
6
- require "json"
7
- require "wally/parses_features"
8
- features = []
9
- ARGV[2..-1].each do |arg|
10
- Dir.glob(File.join("#{arg}", "**/*.feature")).each do |feature_path|
11
- begin
12
- gherkin = Wally::ParsesFeatures.new.parse(File.read(feature_path))
13
- rescue
14
- puts "Couldn't parse '#{feature_path}'"
15
- puts "Contents:"
16
- puts File.read(feature_path)
17
- end
18
- features << {:path => feature_path, :gherkin => gherkin}
19
- end
20
- end
21
- RestClient.put "#{ARGV[1]}/features/?authentication_code=#{File.read(".wally").strip}", features.to_json, {:content_type => :json, :accept => :json}
22
- elsif ARGV[0] == "destroy"
23
- require "restclient"
24
- RestClient.delete "#{ARGV[1]}?authentication_code=#{File.read(".wally").strip}"
25
- else
26
- puts "Usage:"
27
- puts " wally push <url>/projects/<project-name> <features-dir>"
28
- puts " wally destroy <url>/projects/<project-name>"
29
- end
4
+ require 'wally/client'
5
+ Wally::Client::CLI.run ARGV
@@ -0,0 +1,27 @@
1
+ Feature: Push Features To Server
2
+ In order to easily get features on the server
3
+ As a developer
4
+ I want to be able to push features to an endpoint
5
+
6
+ Scenario: Push features without authentication
7
+ Given I don't have a .wally authorisation file
8
+ When I upload features for "my_project_name"
9
+ Then "my_project_name" should not exist
10
+
11
+ Scenario: Push features with authentication
12
+ Given I have a .wally authentication file
13
+ When I upload features for "project1"
14
+ Then "project1" should exist
15
+ And I should see the uploaded features
16
+
17
+ Scenario: Delete projects without authorisation
18
+ Given I have a project called "project1"
19
+ And I don't have a .wally authorisation file
20
+ When I delete the project called "project1"
21
+ Then "project1" should exist
22
+
23
+ Scenario: Delete projects with authorisation
24
+ Given I have a project called "project1"
25
+ And I have a .wally authentication file
26
+ When I delete the project called "project1"
27
+ Then "project1" should not exist
@@ -0,0 +1,47 @@
1
+ #Setup
2
+ Given /^I don't have a \.wally authorisation file$/ do
3
+ end
4
+
5
+ Given /^I have a \.wally authentication file$/ do
6
+ @authentication_code = "authCodE!!2322"
7
+ write_file('.wally', @authentication_code)
8
+ end
9
+
10
+ feature = <<-SQL.gsub(/^\s+\|/,'')
11
+ |Feature: Some Feature Name
12
+ |
13
+ | Scenario: Whatever
14
+ | Given I do something
15
+ | Then it happens
16
+ SQL
17
+
18
+ Given /^I have a project called "([^"]*)"$/ do |project_name|
19
+ step "I have a .wally authentication file"
20
+ step %Q%I upload features for "#{project_name}"%
21
+ remove_file ".wally" rescue Errno::ENOENT
22
+ end
23
+
24
+ # Actually test our client
25
+ When /^I upload features for "([^"]*)"$/ do |project_name|
26
+ write_file('example-features/some_feature.feature', feature)
27
+ run_simple("wally push http://#{WallyHost.url}/projects/#{project_name} example-features/", false)
28
+ end
29
+
30
+ When /^I delete the project called "([^"]*)"$/ do |project_name|
31
+ run_simple("wally destroy http://#{WallyHost.url}/projects/#{project_name}", false)
32
+ end
33
+
34
+ # Assertions
35
+ Then /^"([^"]*)" should exist$/ do |project_name|
36
+ @output = Net::HTTP.get(URI.parse "http://#{WallyHost.url}/projects/#{project_name}")
37
+ expect(@output).to have_content project_name
38
+ end
39
+
40
+ Then /^"([^"]*)" should not exist$/ do |project_name|
41
+ @output = Net::HTTP.get(URI.parse "http://#{WallyHost.url}/projects/#{project_name}")
42
+ expect(@output).to_not have_content project_name
43
+ end
44
+
45
+ Then /^I should see the uploaded features$/ do
46
+ expect(@output).to have_content "Feature Name"
47
+ end
@@ -0,0 +1,40 @@
1
+ $:.unshift(File.join(File.dirname(__FILE__), "../../lib"))
2
+ ENV['RACK_ENV'] = 'test'
3
+
4
+ require 'aruba/cucumber'
5
+ require 'capybara/cucumber'
6
+
7
+ Capybara.app = Rack::Builder.new_from_string(<<-FILE)
8
+ require 'bundler/setup'
9
+ require 'wally'
10
+
11
+ run Sinatra::Application
12
+ FILE
13
+
14
+ module WallyHost
15
+ def server
16
+ @server ||= Capybara::Server.new(Capybara.app)
17
+ end
18
+ module_function :server
19
+
20
+ def url
21
+ "#{server.host}:#{server.port}"
22
+ end
23
+ module_function :url
24
+ end
25
+
26
+ Before do
27
+ WallyHost.server.boot
28
+ raise "not booted" unless WallyHost.server.responsive?
29
+ end
30
+
31
+ require 'mongo_mapper'
32
+ MongoMapper.connection = Mongo::Connection.new('localhost')
33
+ MongoMapper.database = "wally"
34
+
35
+ After do
36
+ remove_file ".wally" rescue Errno::ENOENT
37
+ MongoMapper.database.collections.each do |coll|
38
+ coll.remove unless coll.name =~ /system/
39
+ end
40
+ end
@@ -1 +1,9 @@
1
1
  require 'wally/client/version'
2
+
3
+ module Wally
4
+ module Client
5
+ autoload 'CLI', 'wally/client/cli'
6
+ autoload 'Command', 'wally/client/command'
7
+ autoload 'Parser', 'wally/client/parser'
8
+ end
9
+ end
@@ -0,0 +1,30 @@
1
+ require 'optparse'
2
+
3
+ module Wally
4
+ module Client
5
+ class CLI
6
+
7
+ def self.run args
8
+ OptionParser.new do |parser|
9
+ parser.banner = <<-Banner.gsub(/^\s+\|/,'')
10
+ |Usage:
11
+ | wally push <url>/projects/<project-name> <features-dir>
12
+ | wally destroy <url>/projects/<project-name>
13
+ Banner
14
+ end.parse(args)
15
+
16
+ command, url, *features = ARGV
17
+
18
+ case command
19
+ when "push" then Command.new(url).push Parser.parse(features)
20
+ when "destroy" then Command.new(url).destroy
21
+ else
22
+ abort "Please use --help for a listing of valid options"
23
+ end
24
+ rescue Wally::FeatureParseException
25
+ puts "Couldn't parse features."
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,44 @@
1
+ require "restclient"
2
+
3
+ module Wally
4
+ module Client
5
+ class Command
6
+
7
+ def initialize url
8
+ @url = url
9
+ end
10
+
11
+ def push features
12
+ RestClient.put url("/features/"), jsonify(features), json_headers
13
+ end
14
+
15
+ def destroy
16
+ RestClient.delete url
17
+ end
18
+
19
+ private
20
+
21
+ def code
22
+ if File.exist?('.wally')
23
+ '?authentication_code=' + File.read(".wally").strip
24
+ else
25
+ ''
26
+ end
27
+ end
28
+
29
+ def url part = ""
30
+ [@url, part, code].join
31
+ end
32
+
33
+ def jsonify features
34
+ require "json"
35
+ features.to_json
36
+ end
37
+
38
+ def json_headers
39
+ { :content_type => :json, :accept => :json }
40
+ end
41
+
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,27 @@
1
+ require "wally/parses_features"
2
+
3
+ module Wally
4
+ module Client
5
+ class Parser
6
+
7
+ def self.parse paths
8
+ new(paths).load
9
+ end
10
+
11
+ def initialize paths
12
+ @paths = paths
13
+ end
14
+
15
+ def load
16
+ @paths.inject([]) do |features, path|
17
+ Dir.glob(File.join(path, "**/*.feature")) do |feature_path|
18
+ gherkin = Wally::ParsesFeatures.new.parse(File.read feature_path)
19
+ features << {:path => feature_path, :gherkin => gherkin}
20
+ end
21
+ features
22
+ end
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -1,5 +1,5 @@
1
1
  module Wally
2
2
  module Client
3
- VERSION = "0.0.3"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
@@ -17,7 +17,7 @@ module Wally
17
17
  parser = Gherkin::Parser::Parser.new(formatter, false, 'root')
18
18
  begin
19
19
  parser.parse(text, nil, 0)
20
- rescue Exception => e
20
+ rescue
21
21
  raise FeatureParseException.new
22
22
  end
23
23
  hash = formatter.to_hash
@@ -0,0 +1,24 @@
1
+ require 'wally/parses_features'
2
+
3
+ describe "Wally::ParsesFeatures" do
4
+ def output_for string
5
+ Wally::ParsesFeatures.new.parse(string)
6
+ end
7
+
8
+ it "parses feature files" do
9
+ feature = "Feature: Do stuff!"
10
+ expect(output_for feature).to eq({
11
+ "keyword" => "Feature",
12
+ "name" => "Do stuff!",
13
+ "line" => 1,
14
+ "description" => "",
15
+ "id" => "do-stuff!",
16
+ "uri" => nil
17
+ })
18
+ end
19
+
20
+ it "raises nice errors" do
21
+ feature = "!WEFFW"
22
+ expect { output_for feature }.to raise_error Wally::FeatureParseException
23
+ end
24
+ end
@@ -21,4 +21,9 @@ Gem::Specification.new do |s|
21
21
  s.add_runtime_dependency "rest-client"
22
22
  s.add_runtime_dependency "gherkin"
23
23
 
24
+ s.add_development_dependency "rspec"
25
+ s.add_development_dependency "cucumber"
26
+ s.add_development_dependency "aruba"
27
+ s.add_development_dependency "wally"
28
+ s.add_development_dependency "capybara"
24
29
  end
metadata CHANGED
@@ -1,82 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wally-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Rowe
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - ! '-----BEGIN CERTIFICATE-----
12
-
13
- MIIDVjCCAj6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBRMQ4wDAYDVQQDDAVoZWxs
14
-
15
- bzEXMBUGCgmSJomT8ixkARkWB2pvbnJvd2UxEjAQBgoJkiaJk/IsZAEZFgJjbzES
16
-
17
- MBAGCgmSJomT8ixkARkWAnVrMB4XDTEzMDIwMzA4MTgwNloXDTE0MDIwMzA4MTgw
18
-
19
- NlowUTEOMAwGA1UEAwwFaGVsbG8xFzAVBgoJkiaJk/IsZAEZFgdqb25yb3dlMRIw
20
-
21
- EAYKCZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJ1azCCASIwDQYJKoZI
22
-
23
- hvcNAQEBBQADggEPADCCAQoCggEBAMhs6ng/SRrYfG7RtQx8liJTZs8tpz7PBnlH
24
-
25
- qyOwuU0weJc7nh6C9C8LGyJzpkbjJJo1rfTMg7huDyL14Py82dfMDomApif8jNNI
26
-
27
- 8KtviAgB1DrWq0fCDLtu/M77+yuVV3OhDdrAFaBkT/euvdJ8cAKrLxbJ+klgvrcB
28
-
29
- FK+c4PUV3/zBKghe0l7FuDhyQCsuLNDbWyFvDS97tPjeN6yWuszwg22vZMDdsuzN
30
-
31
- Cj3M4LLSkbrt+AOUcysEJxI4t6uv2U1bRzHsDfAF0RI/Q7OMtUr+Dtz/2YJ47KKs
32
-
33
- 51ZRjLLGHd10XrIfFSfGyJj1dMbDgLsEBj1sFH4e6dy7gau8TaUCAwEAAaM5MDcw
34
-
35
- CQYDVR0TBAIwADAdBgNVHQ4EFgQULu5JH2g7RAjoXaZt+fbrfNDI9IkwCwYDVR0P
36
-
37
- BAQDAgSwMA0GCSqGSIb3DQEBBQUAA4IBAQAf5A4kB769DPKGjPZ++v42FwVi7X7v
38
-
39
- RpufPs6R4YHyzHXaJmAqnhleZhVJijBgsdb2SigNRbg+IK8XYHg7jkonMgO8OS3D
40
-
41
- C6w8VB5bI0PqyDOwCGcQkYHYlZZWCghAyBTSBowHAekMb9V3QjJtJ8XkizjshETO
42
-
43
- ZCVI2AObjlJi8I10aK2tSo9sv2riCKZ92BVSM13zYWn+C/eCP/m9BDiw37UQtuQq
44
-
45
- 2feWfO4gCNmvfFjULOAYHq9JHEjN5SLSXvj5HdSnDcCyIfJKn5Ya3JahWQaWIsXf
46
-
47
- /NPE/mB57TOwj+d7XUa2NC4HUadF8R51IYEcIB0PpIEzJlKtfXFcOZxO
48
-
49
- -----END CERTIFICATE-----
50
-
51
- '
52
- date: 2013-09-17 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2014-07-15 00:00:00.000000000 Z
53
12
  dependencies:
54
13
  - !ruby/object:Gem::Dependency
55
14
  name: rest-client
56
15
  requirement: !ruby/object:Gem::Requirement
57
16
  requirements:
58
- - - ! '>='
17
+ - - ">="
59
18
  - !ruby/object:Gem::Version
60
19
  version: '0'
61
20
  type: :runtime
62
21
  prerelease: false
63
22
  version_requirements: !ruby/object:Gem::Requirement
64
23
  requirements:
65
- - - ! '>='
24
+ - - ">="
66
25
  - !ruby/object:Gem::Version
67
26
  version: '0'
68
27
  - !ruby/object:Gem::Dependency
69
28
  name: gherkin
70
29
  requirement: !ruby/object:Gem::Requirement
71
30
  requirements:
72
- - - ! '>='
31
+ - - ">="
73
32
  - !ruby/object:Gem::Version
74
33
  version: '0'
75
34
  type: :runtime
76
35
  prerelease: false
77
36
  version_requirements: !ruby/object:Gem::Requirement
78
37
  requirements:
79
- - - ! '>='
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: cucumber
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: aruba
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: wally
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: capybara
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
80
109
  - !ruby/object:Gem::Version
81
110
  version: '0'
82
111
  description: Feature uploader for wally
@@ -87,15 +116,24 @@ executables:
87
116
  extensions: []
88
117
  extra_rdoc_files: []
89
118
  files:
90
- - .gitignore
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".travis.yml"
91
122
  - Gemfile
92
123
  - LICENSE
93
124
  - README.md
94
125
  - Rakefile
95
126
  - bin/wally
127
+ - features/push_features.feature
128
+ - features/step_definitions/push_features_steps.rb
129
+ - features/support/env.rb
96
130
  - lib/wally/client.rb
131
+ - lib/wally/client/cli.rb
132
+ - lib/wally/client/command.rb
133
+ - lib/wally/client/parser.rb
97
134
  - lib/wally/client/version.rb
98
135
  - lib/wally/parses_features.rb
136
+ - spec/wally/parses_features_spec.rb
99
137
  - wally-client.gemspec
100
138
  homepage: https://github.com/JonRowe/wally-client
101
139
  licenses:
@@ -107,18 +145,22 @@ require_paths:
107
145
  - lib
108
146
  required_ruby_version: !ruby/object:Gem::Requirement
109
147
  requirements:
110
- - - ! '>='
148
+ - - ">="
111
149
  - !ruby/object:Gem::Version
112
150
  version: '0'
113
151
  required_rubygems_version: !ruby/object:Gem::Requirement
114
152
  requirements:
115
- - - ! '>='
153
+ - - ">="
116
154
  - !ruby/object:Gem::Version
117
155
  version: '0'
118
156
  requirements: []
119
157
  rubyforge_project:
120
- rubygems_version: 2.1.3
158
+ rubygems_version: 2.2.2
121
159
  signing_key:
122
160
  specification_version: 4
123
161
  summary: Feature uploader for wally
124
- test_files: []
162
+ test_files:
163
+ - features/push_features.feature
164
+ - features/step_definitions/push_features_steps.rb
165
+ - features/support/env.rb
166
+ - spec/wally/parses_features_spec.rb
Binary file
data.tar.gz.sig DELETED
@@ -1,3 +0,0 @@
1
- ��5N�{��f[�
2
- �Wt��&�G���3nyR��묃���#H�B�� f�-�_�&�H�+c���ךӛ�}�k��\4csZV��� ��
3
- �����Ot:�@����7��L�8�1��
metadata.gz.sig DELETED
@@ -1 +0,0 @@
1
- �h�}�^�W��'�Ⴜ{�a G ea���