relish 0.0.1 → 0.0.2

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.
data/.gitignore CHANGED
@@ -2,4 +2,5 @@
2
2
  .DS_Store
3
3
  .rvmrc
4
4
  *.gem
5
- tmp
5
+ tmp
6
+ Gemfile.lock
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2008,2009 Matt Patterson, Matt Wynne, Justin Ko
3
+ Copyright (c) 2010 Matt Wynne, Justin Ko
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -5,4 +5,9 @@ Bundler::GemHelper.install_tasks
5
5
  require 'rake'
6
6
  require 'rspec/core/rake_task'
7
7
 
8
- RSpec::Core::RakeTask.new
8
+ RSpec::Core::RakeTask.new
9
+
10
+ require 'cucumber/rake/task'
11
+ Cucumber::Rake::Task.new
12
+
13
+ task :default => [:spec, :cucumber]
data/bin/relish CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
  $:.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))
3
3
 
4
+ require 'relish/command'
5
+
4
6
  args = ARGV.dup
5
7
  ARGV.clear
6
8
  command = args.shift.strip rescue 'help'
7
9
 
8
- Relish::Cli::Runner.run(command, $stderr, $stdout)
10
+ Relish::Command.run(command, args)
data/cucumber.yml ADDED
@@ -0,0 +1 @@
1
+ default: --format progress
@@ -1,8 +1,12 @@
1
+ @announce
1
2
  Feature: Push
2
- As a Relish user
3
- In order to push my features to the Relish server
4
- I want to run the relish push command
3
+ In order to send my features to relishapp.com
4
+ As a Relish user dev
5
+ I want a push command
5
6
 
6
- Scenario: Push one feature file to a project
7
- Given pending
8
-
7
+ Background:
8
+ Given my API token "1234" is stored
9
+
10
+ Scenario: Specify everything at the command-line
11
+ When I run relish push --host localhost:1234 --project p
12
+ When it should POST to "http://localhost:1234/pushes?project_id=p&api_token=1234"
@@ -0,0 +1,7 @@
1
+ require 'aruba'
2
+ gem_bin_path = File.dirname(__FILE__) + '/../../bin'
3
+ ENV['PATH'] = "#{gem_bin_path}:#{ENV['PATH']}"
4
+
5
+ When /^I run relish ([^\s]*) (.*)$/ do |command, args|
6
+ Relish::Command.run(command, args.split(" "))
7
+ end
@@ -0,0 +1,8 @@
1
+ require 'fake_web'
2
+ FakeWeb.allow_net_connect = false
3
+ FakeWeb.register_uri(:any, /.*/, :body => "Faked HTTP response")
4
+
5
+ When /^it should POST to "http:\/\/localhost:1234([^"]*)"$/ do |path|
6
+ request = FakeWeb.last_request || raise("Fakeweb did not record a request.")
7
+ request.path.should == path
8
+ end
@@ -0,0 +1,6 @@
1
+ Given /^my API token "([^"]*)" is stored$/ do |api_token|
2
+ # yeah! dirty hack
3
+ Relish::Command::Base.class_eval do
4
+ define_method(:api_token) { api_token }
5
+ end
6
+ end
@@ -1 +1,4 @@
1
- require 'aruba'
1
+ $:.unshift(File.dirname(__FILE__) + '/../../lib')
2
+ require 'relish/command'
3
+
4
+ Relish::Command::Base::GLOBAL_OPTIONS_FILE = '~/.relish'
@@ -1,2 +1,18 @@
1
1
  require 'relish/commands/base'
2
- require 'relish/commands/push'
2
+ require 'relish/commands/push'
3
+
4
+ module Relish
5
+ module Command
6
+
7
+ def self.run(command, args)
8
+ command_class, method = get_command_and_method(command, args)
9
+ command_class.new(args).send(method)
10
+ end
11
+
12
+ def self.get_command_and_method(command, args)
13
+ command_class, method = command.split(':')
14
+ return Relish::Command.const_get(command_class.capitalize), (method || :default)
15
+ end
16
+
17
+ end
18
+ end
@@ -1,41 +1,45 @@
1
- require 'trollop'
1
+ require 'yaml'
2
2
 
3
3
  module Relish
4
4
  module Command
5
5
  class Base
6
- include Relish::Helpers
7
-
8
6
  DEFAULT_HOST = 'relishapp.com'
7
+ GLOBAL_OPTIONS_FILE = File.join(File.expand_path('~'), '.relish')
9
8
  LOCAL_OPTIONS_FILE = '.relish'
10
9
 
11
- def initialize(global_options = {})
12
- @options = global_options
10
+ attr_reader :args
11
+
12
+ def initialize(args)
13
+ @args = args
14
+ @options = get_options
13
15
  end
14
16
 
15
- [:account, :project].each do |meth|
16
- define_method meth do
17
- @options[meth] || parse_options_file[meth]
18
- end
17
+ def organization
18
+ @options['--organization'] || @options['-o'] || parsed_options_file['organization']
19
19
  end
20
20
 
21
- def host
22
- @options[:host] || DEFAULT_HOST
21
+ def project
22
+ @options['--project'] || @options['-p'] || parsed_options_file['project']
23
23
  end
24
24
 
25
- def parse_options_file
26
- @parsed_options_file ||= begin
27
- if File.exist?(LOCAL_OPTIONS_FILE)
28
- parser = Trollop::Parser.new
29
- parser.opt :account, "", :short => '-a', :type => String
30
- parser.opt :project, "", :short => '-p', :type => String
31
- parser.opt :version, "", :short => '-v', :type => String
32
- parser.parse(File.read(LOCAL_OPTIONS_FILE).split)
33
- else {} end
34
- end
25
+ def host
26
+ @options['--host'] || DEFAULT_HOST
35
27
  end
36
28
 
37
29
  def api_token
38
- File.read("#{home_directory}/.relish/api_token")
30
+ parsed_options_file['api_token']
31
+ end
32
+
33
+ def get_options
34
+ parsed_options_file.merge(Hash[*args])
35
+ end
36
+
37
+ def parsed_options_file
38
+ @parsed_options_file ||= {}.tap do |parsed_options|
39
+ [GLOBAL_OPTIONS_FILE, LOCAL_OPTIONS_FILE].each do |options_file|
40
+ parsed_options.merge!(YAML.load_file(options_file)) if File.exist?(options_file)
41
+ end
42
+ end
39
43
  end
40
44
 
41
45
  end
@@ -0,0 +1,10 @@
1
+ module Relish
2
+ module Command
3
+ class Config < Base
4
+
5
+ def default
6
+ end
7
+
8
+ end
9
+ end
10
+ end
@@ -1,3 +1,4 @@
1
+ require 'rubygems'
1
2
  require 'zlib'
2
3
  require 'archive/tar/minitar'
3
4
  require 'stringio'
@@ -7,6 +8,10 @@ module Relish
7
8
  module Command
8
9
  class Push < Base
9
10
 
11
+ def default
12
+ run
13
+ end
14
+
10
15
  def run
11
16
  post files_as_tar_gz
12
17
  end
@@ -15,10 +20,7 @@ module Relish
15
20
  resource = RestClient::Resource.new(url)
16
21
  resource.post(tar_gz_data, :content_type => 'application/x-gzip')
17
22
  puts "sent:\n#{files.join("\n")}"
18
- rescue RestClient::ResourceNotFound,
19
- RestClient::Unauthorized,
20
- RestClient::BadRequest => exception
21
-
23
+ rescue RestClient::Exception => exception
22
24
  warn exception.response
23
25
  exit 1
24
26
  end
@@ -26,7 +28,7 @@ module Relish
26
28
  def url
27
29
  "".tap do |str|
28
30
  str << "http://#{host}/pushes?"
29
- str << "account_id=#{account}&"
31
+ str << "creator_id=#{organization}&" if organization
30
32
  str << "project_id=#{project}&"
31
33
  str << "version_id=#{version}&" if version
32
34
  str << "api_token=#{api_token}"
@@ -34,7 +36,7 @@ module Relish
34
36
  end
35
37
 
36
38
  def version
37
- @options[:version]
39
+ @options['--version'] || @options['-v']
38
40
  end
39
41
 
40
42
  def files_as_tar_gz
@@ -52,7 +54,7 @@ module Relish
52
54
  end
53
55
 
54
56
  def files
55
- Dir['features/**/*.{feature,md}']
57
+ Dir['features/**/*.{feature,md,markdown}']
56
58
  end
57
59
 
58
60
  end
data/relish.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "relish"
3
- s.version = "0.0.1"
3
+ s.version = "0.0.2"
4
4
 
5
5
  s.required_rubygems_version = '>= 1.3.5'
6
- s.authors = ["Matt Patterson", "Matt Wynne", "Justin Ko"]
6
+ s.authors = ["Matt Wynne", "Justin Ko"]
7
7
  s.date = "2010-09-23"
8
8
  s.description = %q{Client gem for http://relishapp.com}
9
9
  s.email = "jko170@gmail.com"
@@ -16,17 +16,23 @@ Gem::Specification.new do |s|
16
16
  s.require_path = "lib"
17
17
  s.files = `git ls-files`.split("\n")
18
18
  s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+
21
+ {
22
+ 'archive-tar-minitar' => '~> 0.5.2',
23
+ 'rest-client' => '~> 1.6.1',
24
+ }.each do |lib, version|
25
+ s.add_runtime_dependency lib, version
26
+ end
19
27
 
20
28
  {
21
29
  'bundler' => '~> 1.0.0',
22
30
  'rake' => '~> 0.8.7',
23
- 'archive-tar-minitar' => '~> 0.5.2',
24
- 'rest-client' => '~> 1.6.1',
25
- 'trollop' => '~> 1.16.2',
26
- 'rspec' => '~> 2.0.0.beta.22',
31
+ 'rspec' => '~> 2.0.0',
27
32
  'cucumber' => '~> 0.9.1',
28
- 'aruba' => '~> 0.2.2'
33
+ 'aruba' => '~> 0.2.2',
34
+ 'fakeweb' => '~> 1.3.0'
29
35
  }.each do |lib, version|
30
36
  s.add_development_dependency lib, version
31
37
  end
32
- end
38
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Relish::Command do
4
+
5
+ it "recognizes the 'push' command" do
6
+ push = double
7
+ push.should_receive(:default)
8
+ Relish::Command::Push.should_receive(:new).with([]).and_return(push)
9
+ Relish::Command.run('push', [])
10
+ end
11
+
12
+ end
@@ -3,19 +3,40 @@ require 'spec_helper'
3
3
  module Relish
4
4
  module Command
5
5
  describe Base do
6
-
7
- {:account => 'rspec', :project => 'rspec-core'}.each do |meth, name|
6
+
7
+ {:organization => 'rspec', :project => 'rspec-core'}.each do |meth, name|
8
8
  describe "##{meth}" do
9
- context 'passed in command line' do
10
- let(:base) { described_class.new({meth => name}) }
9
+ context 'passed in command line as full arg' do
10
+ let(:base) { described_class.new(["--#{meth}", name]) }
11
+
12
+ it 'returns the value' do
13
+ base.send(meth).should eq(name)
14
+ end
15
+ end
16
+
17
+ context 'passed in command line as short arg' do
18
+ let(:short_arg) { meth.to_s[0,1] }
19
+ let(:base) { described_class.new(["-#{short_arg}", name]) }
20
+
21
+ it 'returns the value' do
22
+ base.send(meth).should eq(name)
23
+ end
24
+ end
11
25
 
26
+ context 'contained in the options file' do
27
+ let(:base) { described_class.new([]) }
28
+
29
+ before do
30
+ base.stub(:parsed_options_file).and_return({meth.to_s => name})
31
+ end
32
+
12
33
  it 'returns the value' do
13
34
  base.send(meth).should eq(name)
14
35
  end
15
36
  end
16
37
 
17
38
  context 'not passed in command line' do
18
- let(:base) { described_class.new }
39
+ let(:base) { described_class.new([]) }
19
40
 
20
41
  context 'and options file does not exist' do
21
42
  it 'returns nil' do
@@ -28,7 +49,7 @@ module Relish
28
49
 
29
50
  describe '#host' do
30
51
  context 'passed in command line' do
31
- let(:base) { described_class.new({:host => 'test.com'}) }
52
+ let(:base) { described_class.new(['--host', 'test.com']) }
32
53
 
33
54
  it 'returns test.com' do
34
55
  base.host.should eq('test.com')
@@ -36,7 +57,7 @@ module Relish
36
57
  end
37
58
 
38
59
  context 'not passed in command line' do
39
- let(:base) { described_class.new }
60
+ let(:base) { described_class.new([]) }
40
61
 
41
62
  it 'returns the default host' do
42
63
  base.host.should eq(Base::DEFAULT_HOST)
@@ -44,25 +65,53 @@ module Relish
44
65
  end
45
66
  end
46
67
 
47
- describe '#parse_options_file' do
48
- let(:base) { described_class.new }
68
+ describe '#api_token' do
69
+ let(:base) { described_class.new([]) }
70
+ let(:options) { {'api_token' => '12345'} }
71
+
72
+ before do
73
+ base.should_receive(:parsed_options_file).and_return(options)
74
+ end
75
+
76
+ it 'parses the api token' do
77
+ base.api_token.should eq('12345')
78
+ end
79
+ end
80
+
81
+ describe '#get_options' do
82
+ let(:base) { described_class.new(['--project', 'rspec-core']) }
83
+ let(:options) { {'project' => 'rspec-core'} }
84
+
85
+ before do
86
+ base.should_receive(:parsed_options_file).and_return(options)
87
+ end
88
+
89
+ it 'combines the args and options file' do
90
+ base.get_options.should eq(
91
+ {'project' => 'rspec-core', '--project' => 'rspec-core'}
92
+ )
93
+ end
94
+ end
95
+
96
+ describe '#parsed_options_file' do
97
+ let(:base) { described_class.new([]) }
49
98
 
50
99
  context 'with options file that exists' do
51
100
  let(:options) do
52
- '--account rspec --project rspec-core'
101
+ {'organization' => 'rspec', 'project' => 'rspec-core'}
53
102
  end
54
103
 
55
104
  before do
56
- File.stub(:exist?).and_return(true)
57
- File.stub(:read).and_return(options)
105
+ File.should_receive(:exist?).twice.and_return(true)
106
+ YAML.should_receive(:load_file).twice.and_return(options)
58
107
  end
59
108
 
60
- it 'parses the account' do
61
- base.parse_options_file[:account].should eq('rspec')
109
+ it 'parses the organization' do
110
+ base.parsed_options_file['organization'].should eq('rspec')
62
111
  end
63
112
 
64
113
  it 'parses the project' do
65
- base.parse_options_file[:project].should eq('rspec-core')
114
+ base.parsed_options_file['project'].should eq('rspec-core')
66
115
  end
67
116
  end
68
117
 
@@ -72,21 +121,11 @@ module Relish
72
121
  end
73
122
 
74
123
  it 'returns an empty hash' do
75
- base.parse_options_file.should eq({})
124
+ base.parsed_options_file.should eq({})
76
125
  end
77
126
  end
78
127
  end
79
128
 
80
- describe '#api_token' do
81
- let(:base) { described_class.new }
82
-
83
- it 'calls File.read with the correct path' do
84
- base.should_receive(:home_directory).and_return('~')
85
- File.should_receive(:read).with('~/.relish/api_token')
86
- base.api_token
87
- end
88
- end
89
-
90
129
  end
91
130
  end
92
131
  end
@@ -4,55 +4,62 @@ module Relish
4
4
  module Command
5
5
  describe Push do
6
6
 
7
+ describe '#default' do
8
+ let(:push) { described_class.new([]) }
9
+
10
+ it 'calls #run' do
11
+ push.should_receive(:run)
12
+ push.default
13
+ end
14
+ end
15
+
7
16
  describe '#url' do
8
17
  before do
9
- push.should_receive(:account).and_return('rspec')
10
18
  push.should_receive(:project).and_return('rspec')
11
19
  push.should_receive(:api_token).and_return('abc')
12
20
  end
13
21
 
14
22
  context 'without version' do
15
- let(:push) { described_class.new }
23
+ let(:push) { described_class.new([]) }
16
24
 
17
25
  specify do
18
26
  push.url.should eq(
19
- "http://relishapp.com/pushes?account_id=rspec&project_id=rspec&api_token=abc"
27
+ "http://relishapp.com/pushes?project_id=rspec&api_token=abc"
20
28
  )
21
29
  end
22
30
  end
23
31
 
24
32
  context 'with version' do
25
- let(:push) { described_class.new(:version => 'one') }
33
+ let(:push) { described_class.new(['--version', 'one']) }
26
34
 
27
35
  specify do
28
36
  push.url.should eq(
29
- "http://relishapp.com/pushes?" \
30
- "account_id=rspec&project_id=rspec&version_id=one&api_token=abc"
37
+ "http://relishapp.com/pushes?project_id=rspec&version_id=one&api_token=abc"
31
38
  )
32
39
  end
33
40
  end
34
41
  end
35
42
 
36
43
  describe '#version' do
37
- context 'with :version in @options' do
38
- let(:push) { described_class.new(:version => 'one') }
44
+ context 'with --version in @options' do
45
+ let(:push) { described_class.new(['--version', 'one']) }
39
46
  specify { push.version.should eq('one') }
40
47
  end
41
48
 
42
- context 'with :version not in @options' do
43
- let(:push) { described_class.new }
49
+ context 'with --version not in @options' do
50
+ let(:push) { described_class.new([]) }
44
51
  specify { push.version.should be_nil }
45
52
  end
46
53
  end
47
54
 
48
55
  describe '#files_as_tar_gz' do
49
- let(:push) { described_class.new }
56
+ let(:push) { described_class.new([]) }
50
57
  specify { expect { push.files_as_tar_gz }.to_not raise_exception }
51
58
  specify { push.files_as_tar_gz.should be_a(String) }
52
59
  end
53
60
 
54
61
  describe '#files' do
55
- let(:push) { described_class.new }
62
+ let(:push) { described_class.new([]) }
56
63
  specify { expect { push.files }.to_not raise_exception }
57
64
  specify { push.files.should be_a(Array) }
58
65
  end
data/spec/spec_helper.rb CHANGED
@@ -2,8 +2,12 @@ require 'rubygems'
2
2
  require 'bundler'
3
3
  Bundler.setup
4
4
 
5
- require 'relish'
5
+ require 'relish/command'
6
6
 
7
7
  RSpec.configure do |config|
8
8
  config.color_enabled = true
9
+
10
+ config.before(:suite) do
11
+ Relish::Command::Base::GLOBAL_OPTIONS_FILE = '~/.relish'
12
+ end
9
13
  end
metadata CHANGED
@@ -1,121 +1,118 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relish
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
- - Matt Patterson
14
13
  - Matt Wynne
15
14
  - Justin Ko
16
15
  autorequire:
17
16
  bindir: bin
18
17
  cert_chain: []
19
18
 
20
- date: 2010-09-23 00:00:00 -04:00
19
+ date: 2010-09-23 00:00:00 +01:00
21
20
  default_executable:
22
21
  dependencies:
23
22
  - !ruby/object:Gem::Dependency
24
- name: rake
23
+ name: rest-client
25
24
  prerelease: false
26
25
  requirement: &id001 !ruby/object:Gem::Requirement
27
26
  none: false
28
27
  requirements:
29
28
  - - ~>
30
29
  - !ruby/object:Gem::Version
31
- hash: 49
30
+ hash: 13
32
31
  segments:
33
- - 0
34
- - 8
35
- - 7
36
- version: 0.8.7
37
- type: :development
32
+ - 1
33
+ - 6
34
+ - 1
35
+ version: 1.6.1
36
+ type: :runtime
38
37
  version_requirements: *id001
39
38
  - !ruby/object:Gem::Dependency
40
- name: rspec
39
+ name: archive-tar-minitar
41
40
  prerelease: false
42
41
  requirement: &id002 !ruby/object:Gem::Requirement
43
42
  none: false
44
43
  requirements:
45
44
  - - ~>
46
45
  - !ruby/object:Gem::Version
47
- hash: 62196431
46
+ hash: 15
48
47
  segments:
49
- - 2
50
- - 0
51
48
  - 0
52
- - beta
53
- - 22
54
- version: 2.0.0.beta.22
55
- type: :development
49
+ - 5
50
+ - 2
51
+ version: 0.5.2
52
+ type: :runtime
56
53
  version_requirements: *id002
57
54
  - !ruby/object:Gem::Dependency
58
- name: aruba
55
+ name: fakeweb
59
56
  prerelease: false
60
57
  requirement: &id003 !ruby/object:Gem::Requirement
61
58
  none: false
62
59
  requirements:
63
60
  - - ~>
64
61
  - !ruby/object:Gem::Version
65
- hash: 19
62
+ hash: 27
66
63
  segments:
64
+ - 1
65
+ - 3
67
66
  - 0
68
- - 2
69
- - 2
70
- version: 0.2.2
67
+ version: 1.3.0
71
68
  type: :development
72
69
  version_requirements: *id003
73
70
  - !ruby/object:Gem::Dependency
74
- name: rest-client
71
+ name: rake
75
72
  prerelease: false
76
73
  requirement: &id004 !ruby/object:Gem::Requirement
77
74
  none: false
78
75
  requirements:
79
76
  - - ~>
80
77
  - !ruby/object:Gem::Version
81
- hash: 13
78
+ hash: 49
82
79
  segments:
83
- - 1
84
- - 6
85
- - 1
86
- version: 1.6.1
80
+ - 0
81
+ - 8
82
+ - 7
83
+ version: 0.8.7
87
84
  type: :development
88
85
  version_requirements: *id004
89
86
  - !ruby/object:Gem::Dependency
90
- name: trollop
87
+ name: rspec
91
88
  prerelease: false
92
89
  requirement: &id005 !ruby/object:Gem::Requirement
93
90
  none: false
94
91
  requirements:
95
92
  - - ~>
96
93
  - !ruby/object:Gem::Version
97
- hash: 83
94
+ hash: 15
98
95
  segments:
99
- - 1
100
- - 16
101
96
  - 2
102
- version: 1.16.2
97
+ - 0
98
+ - 0
99
+ version: 2.0.0
103
100
  type: :development
104
101
  version_requirements: *id005
105
102
  - !ruby/object:Gem::Dependency
106
- name: archive-tar-minitar
103
+ name: aruba
107
104
  prerelease: false
108
105
  requirement: &id006 !ruby/object:Gem::Requirement
109
106
  none: false
110
107
  requirements:
111
108
  - - ~>
112
109
  - !ruby/object:Gem::Version
113
- hash: 15
110
+ hash: 19
114
111
  segments:
115
112
  - 0
116
- - 5
117
113
  - 2
118
- version: 0.5.2
114
+ - 2
115
+ version: 0.2.2
119
116
  type: :development
120
117
  version_requirements: *id006
121
118
  - !ruby/object:Gem::Dependency
@@ -152,8 +149,8 @@ dependencies:
152
149
  version_requirements: *id008
153
150
  description: Client gem for http://relishapp.com
154
151
  email: jko170@gmail.com
155
- executables: []
156
-
152
+ executables:
153
+ - relish
157
154
  extensions: []
158
155
 
159
156
  extra_rdoc_files: []
@@ -161,21 +158,22 @@ extra_rdoc_files: []
161
158
  files:
162
159
  - .gitignore
163
160
  - Gemfile
164
- - Gemfile.lock
165
161
  - LICENSE
166
162
  - README.md
167
163
  - Rakefile
168
164
  - bin/relish
165
+ - cucumber.yml
169
166
  - features/push.feature
167
+ - features/step_definitions/aruba.rb
168
+ - features/step_definitions/fake_web_steps.rb
169
+ - features/step_definitions/relish_steps.rb
170
170
  - features/support/env.rb
171
- - lib/relish.rb
172
- - lib/relish/cli/options.rb
173
- - lib/relish/cli/runner.rb
174
171
  - lib/relish/command.rb
175
172
  - lib/relish/commands/base.rb
173
+ - lib/relish/commands/config.rb
176
174
  - lib/relish/commands/push.rb
177
- - lib/relish/helpers.rb
178
175
  - relish.gemspec
176
+ - spec/relish/command_spec.rb
179
177
  - spec/relish/commands/base_spec.rb
180
178
  - spec/relish/commands/push_spec.rb
181
179
  - spec/spec_helper.rb
@@ -217,7 +215,11 @@ specification_version: 3
217
215
  summary: Client gem for http://relishapp.com
218
216
  test_files:
219
217
  - features/push.feature
218
+ - features/step_definitions/aruba.rb
219
+ - features/step_definitions/fake_web_steps.rb
220
+ - features/step_definitions/relish_steps.rb
220
221
  - features/support/env.rb
222
+ - spec/relish/command_spec.rb
221
223
  - spec/relish/commands/base_spec.rb
222
224
  - spec/relish/commands/push_spec.rb
223
225
  - spec/spec_helper.rb
data/Gemfile.lock DELETED
@@ -1,53 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- relish (0.0.1)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- archive-tar-minitar (0.5.2)
10
- aruba (0.2.2)
11
- builder (2.1.2)
12
- cucumber (0.9.1)
13
- builder (~> 2.1.2)
14
- diff-lcs (~> 1.1.2)
15
- gherkin (~> 2.2.5)
16
- json (~> 1.4.6)
17
- term-ansicolor (~> 1.0.5)
18
- diff-lcs (1.1.2)
19
- gherkin (2.2.7)
20
- json (~> 1.4.6)
21
- term-ansicolor (~> 1.0.5)
22
- trollop (~> 1.16.2)
23
- json (1.4.6)
24
- mime-types (1.16)
25
- rake (0.8.7)
26
- rest-client (1.6.1)
27
- mime-types (>= 1.16)
28
- rspec (2.0.0.beta.22)
29
- rspec-core (= 2.0.0.beta.22)
30
- rspec-expectations (= 2.0.0.beta.22)
31
- rspec-mocks (= 2.0.0.beta.22)
32
- rspec-core (2.0.0.beta.22)
33
- rspec-expectations (2.0.0.beta.22)
34
- diff-lcs (>= 1.1.2)
35
- rspec-mocks (2.0.0.beta.22)
36
- rspec-core (= 2.0.0.beta.22)
37
- rspec-expectations (= 2.0.0.beta.22)
38
- term-ansicolor (1.0.5)
39
- trollop (1.16.2)
40
-
41
- PLATFORMS
42
- ruby
43
-
44
- DEPENDENCIES
45
- archive-tar-minitar (~> 0.5.2)
46
- aruba (~> 0.2.2)
47
- bundler (~> 1.0.0)
48
- cucumber (~> 0.9.1)
49
- rake (~> 0.8.7)
50
- relish!
51
- rest-client (~> 1.6.1)
52
- rspec (~> 2.0.0.beta.22)
53
- trollop (~> 1.16.2)
data/lib/relish.rb DELETED
@@ -1,2 +0,0 @@
1
- require 'relish/helpers'
2
- require 'relish/command'
@@ -1,51 +0,0 @@
1
- require 'trollop'
2
- require 'relish/commands/push'
3
-
4
- module Relish
5
- module Cli
6
- class OptionsParser < Trollop::Parser
7
-
8
- COMMANDS = { 'push' => Commands::Push }
9
-
10
- def initialize(error_stream, out_stream)
11
- super
12
-
13
- banner "This is the relish gem. Valid commands are: #{valid_commands.join(",")}"
14
-
15
- opt :help, "Show help information"
16
- opt :host, "Host to connect to", :short => '-h', :type => String
17
- opt :account, "Account to connect to", :short => '-a', :type => String
18
- opt :project, "Project to connect to", :short => '-p', :type => String
19
- opt :version, "Version to connect to", :short => '-v', :type => String
20
-
21
- stop_on valid_commands
22
- end
23
-
24
- def command(args)
25
- Trollop.with_standard_exception_handling(self) do
26
- global_options = parse(args)
27
- grab_command(global_options)
28
- end
29
- end
30
-
31
- private
32
-
33
- def grab_command(global_options)
34
- command_name = leftovers.shift
35
- raise Trollop::HelpNeeded unless command_name
36
- unless valid_commands.include?(command_name)
37
- die("'#{command_name}' is not a relish command", nil)
38
- end
39
- command_class(command_name).new(global_options)
40
- end
41
-
42
- def valid_commands
43
- COMMANDS.keys
44
- end
45
-
46
- def command_class(command_name)
47
- COMMANDS[command_name] or raise(NotImplementedError)
48
- end
49
- end
50
- end
51
- end
@@ -1,12 +0,0 @@
1
- require 'relish/cli/options'
2
-
3
- module Relish
4
- module Cli
5
- class Runner
6
- def self.run(args, error_stream, out_stream)
7
- parser = OptionsParser.new(error_stream, out_stream)
8
- parser.command(args).run
9
- end
10
- end
11
- end
12
- end
@@ -1,15 +0,0 @@
1
- module Relish
2
- module Helpers
3
- def home_directory
4
- running_on_windows? ? ENV['USERPROFILE'] : ENV['HOME']
5
- end
6
-
7
- def running_on_windows?
8
- RUBY_PLATFORM =~ /mswin32|mingw32/
9
- end
10
-
11
- def running_on_a_mac?
12
- RUBY_PLATFORM =~ /-darwin\d/
13
- end
14
- end
15
- end