Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Commit

Permalink
Change organization to publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwynne committed Jul 13, 2012
1 parent a0e7f7c commit 10d29ee
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
13 changes: 6 additions & 7 deletions lib/relish/commands/help.rb
Expand Up @@ -5,13 +5,12 @@ class Help < Base
desc 'show this usage' desc 'show this usage'
command :default do command :default do
puts <<-TEXT puts <<-TEXT
A <project> can be scoped by an organization or user handle. For A <project> can be scoped by a publisher name. For
example, if an organiztion (rspec) has a project (rspec-core), then example, if a publisher (rspec) has a project (rspec-core), then
the <project> would be `rspec/rspec-core`. If a user (justin) has a the <project> would be `rspec/rspec-core`.
project (my-project), then <project> would be `justin/my-project`.
If you leave off the organization or user handle, then it defaults If you leave off the publisher name, then it defaults
to the user (you). to the user (you), assuming you are publishing projects.
TEXT TEXT
puts "=== Available Commands\n\n" puts "=== Available Commands\n\n"
Expand Down Expand Up @@ -53,4 +52,4 @@ def max_usage_length


end end
end end
end end
4 changes: 2 additions & 2 deletions lib/relish/commands/projects.rb
Expand Up @@ -7,7 +7,7 @@ class Projects < Base
puts format(resource['projects'].get(:accept => :json)) puts format(resource['projects'].get(:accept => :json))
end end


usage 'projects:add <org or user handle>/<project handle>' usage 'projects:add <publisher name>/<project name>'
desc 'add a project', desc 'add a project',
'append :private to make the project private', 'append :private to make the project private',
'example: relish projects:add rspec/rspec-core:private' 'example: relish projects:add rspec/rspec-core:private'
Expand Down Expand Up @@ -72,4 +72,4 @@ def private?


end end
end end
end end
14 changes: 7 additions & 7 deletions lib/relish/commands/push.rb
Expand Up @@ -18,11 +18,11 @@ class Push < Base
post files_as_tar_gz, project_params post files_as_tar_gz, project_params
end end


usage 'push:org <organization handle>' usage 'push:publisher <publisher name>'
desc 'push markdown files to an organization', desc 'push markdown files to a publisher',
'example: relish push:org rspec' 'example: relish push:publisher rspec'
command :org do command :publisher do
post files_as_tar_gz, organization_params post files_as_tar_gz, publisher_params
end end


private private
Expand All @@ -40,8 +40,8 @@ def project_params
end end
end end


def organization_params def publisher_params
"organization_id=#{@param}" "publisher_id=#{@param}"
end end


def project def project
Expand Down
14 changes: 7 additions & 7 deletions spec/relish/options_file_spec.rb
Expand Up @@ -11,15 +11,15 @@ module Relish


context 'with options file that exists' do context 'with options file that exists' do
let(:options) do let(:options) do
{'organization' => 'rspec', 'project' => 'rspec-core'} {'publisher' => 'rspec', 'project' => 'rspec-core'}
end end


before do before do
File.open(path, 'w') { |f| YAML.dump(options, f) } File.open(path, 'w') { |f| YAML.dump(options, f) }
end end


it 'parses the organization' do it 'parses the publisher' do
global_options['organization'].should eq('rspec') global_options['publisher'].should eq('rspec')
end end


it 'parses the project' do it 'parses the project' do
Expand All @@ -42,16 +42,16 @@ module Relish
context 'with options file that exists' do context 'with options file that exists' do


let(:options) do let(:options) do
{'organization' => 'rspec', 'project' => 'rspec-core'} {'publisher' => 'rspec', 'project' => 'rspec-core'}
end end


before do before do
File.open(path, 'w') { |f| YAML.dump(options, f) } File.open(path, 'w') { |f| YAML.dump(options, f) }
global_options.store('organization' => 'relish') global_options.store('publisher' => 'relish')
end end


it "over-writes existing values" do it "over-writes existing values" do
OptionsFile.new(path).options['organization'].should == 'relish' OptionsFile.new(path).options['publisher'].should == 'relish'
end end


it 'leaves existing options alone' do it 'leaves existing options alone' do
Expand All @@ -62,4 +62,4 @@ module Relish
end end


end end
end end

0 comments on commit 10d29ee

Please sign in to comment.