socialcast 0.3.4 → 0.3.5

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 ADDED
@@ -0,0 +1,24 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+ *.gem
21
+ .bundle
22
+ Gemfile.lock
23
+ pkg/*
24
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in socialcast.gemspec
4
+ gemspec
data/Rakefile CHANGED
@@ -1,57 +1,16 @@
1
- require 'rubygems'
2
- require 'rake'
3
-
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "socialcast"
8
- gem.summary = %Q{command line interface to socialcast api}
9
- gem.description = %Q{publish messages to your stream from a command line interface}
10
- gem.email = "ryan@socialcast.com"
11
- gem.homepage = "http://github.com/wireframe/socialcast-command-line"
12
- gem.authors = ["Ryan Sonnek"]
13
- gem.add_development_dependency "shoulda", ">= 0"
14
- gem.add_runtime_dependency 'commander', '>= 4.0'
15
- gem.add_runtime_dependency 'rest-client', '>= 1.4.0'
16
- gem.add_runtime_dependency 'json', '>= 1.4.6'
17
- gem.add_runtime_dependency 'activeresource', '>= 2.3.5'
18
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
19
- end
20
- Jeweler::RubygemsDotOrgTasks.new
21
- rescue LoadError
22
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
23
- end
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
24
3
 
4
+ require 'rake'
25
5
  require 'rake/testtask'
6
+
26
7
  Rake::TestTask.new(:test) do |test|
27
8
  test.libs << 'lib' << 'test'
28
- test.pattern = 'test/**/test_*.rb'
29
- test.verbose = true
9
+ test.pattern = 'test/test_*.rb'
30
10
  end
31
11
 
32
- begin
33
- require 'rcov/rcovtask'
34
- Rcov::RcovTask.new do |test|
35
- test.libs << 'test'
36
- test.pattern = 'test/**/test_*.rb'
37
- test.verbose = true
38
- end
39
- rescue LoadError
40
- task :rcov do
41
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
42
- end
12
+ namespace :test do
13
+ task :all => ['test']
43
14
  end
44
15
 
45
- task :test => :check_dependencies
46
-
47
- task :default => :test
48
-
49
- require 'rake/rdoctask'
50
- Rake::RDocTask.new do |rdoc|
51
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
52
-
53
- rdoc.rdoc_dir = 'rdoc'
54
- rdoc.title = "socialcast_cli #{version}"
55
- rdoc.rdoc_files.include('README*')
56
- rdoc.rdoc_files.include('lib/**/*.rb')
57
- end
16
+ task :default => 'test:all'
data/bin/socialcast CHANGED
@@ -4,16 +4,17 @@ require 'commander/import'
4
4
  require 'rest_client'
5
5
  require 'json'
6
6
  require File.join(File.dirname(__FILE__), '..', 'lib', 'socialcast')
7
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'socialcast', 'version')
7
8
  include Socialcast
8
9
 
9
- program :version, File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).strip
10
+ program :version, Socialcast::VERSION
10
11
  program :description, 'Socialcast API command line interface'
11
12
 
12
13
  command :authenticate do |c|
13
14
  c.syntax = 'socialcast authenticate [options]'
14
15
  c.summary = 'authenticate your Socialcast credentials'
15
16
  c.description = 'verify that your credentials are valid'
16
- c.example 'socialcast authenticate -u emily@socialcast.com', 'default usage'
17
+ c.example 'default usage', 'socialcast authenticate -u emily@socialcast.com'
17
18
  c.option '-u', '--user STRING', String, 'Socialcast account username/email'
18
19
  c.option '--domain STRING', String, 'Socialcast community domain'
19
20
  c.action do |args, options|
@@ -41,16 +42,36 @@ command :share do |c|
41
42
  c.syntax = 'socialcast share <message> [options]'
42
43
  c.summary = 'share a message'
43
44
  c.description = 'post a message into your socialcast stream'
44
- c.example 'socialcast share "some text"', 'basic usage'
45
+ c.example 'basic usage', 'socialcast share "some text"'
45
46
  c.option '--url STRING', String, 'referenced url for the message'
47
+ c.option '--attachments FILES', Array, 'list of files to attach to the message'
46
48
  c.action do |args, options|
49
+ options.default :attachments => []
50
+
47
51
  message = args.first
52
+ message ||= $stdin.read_nonblock(100_000) rescue nil
53
+
54
+ attachment_ids = []
55
+ options.attachments.each do |path|
56
+ Dir[File.expand_path(path)].each do |attachment|
57
+ attachment_url = ['https://', credentials[:domain], '/api/attachments.json'].join
58
+ say "Uploading attachment #{attachment}..."
59
+ attachment_uploader = RestClient::Resource.new attachment_url, :user => credentials[:user], :password => credentials[:password]
60
+ attachment_uploader.post :attachment => File.new(attachment) do |response, request, result|
61
+ if response.code == 201
62
+ attachment_ids << JSON.parse(response.body)['attachment']['id']
63
+ else
64
+ say "Error uploading attachment: #{response.body}"
65
+ end
66
+ end
67
+ end
68
+ end
48
69
 
49
70
  Socialcast::Message.site = ['https://', credentials[:domain], '/api'].join
50
71
  Socialcast::Message.user = credentials[:user]
51
72
  Socialcast::Message.password = credentials[:password]
52
73
 
53
- Socialcast::Message.create :body => message, :url => options.url
74
+ Socialcast::Message.create :body => message, :url => options.url, :attachment_ids => attachment_ids
54
75
 
55
76
  say "Message has been shared"
56
77
  end
@@ -0,0 +1,3 @@
1
+ module Socialcast
2
+ VERSION = "0.3.5"
3
+ end
data/socialcast.gemspec CHANGED
@@ -1,69 +1,27 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "socialcast/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{socialcast}
8
- s.version = "0.3.4"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Ryan Sonnek"]
12
- s.date = %q{2011-02-23}
13
- s.default_executable = %q{socialcast}
6
+ s.name = "socialcast"
7
+ s.version = Socialcast::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Ryan Sonnek","Sean Cashin"]
10
+ s.email = ["ryan@socialcast.com"]
11
+ s.homepage = "http://github.com/scashin133/socialcast-command-line"
12
+ s.summary = %q{command line interface to socialcast api}
14
13
  s.description = %q{publish messages to your stream from a command line interface}
15
- s.email = %q{ryan@socialcast.com}
16
- s.executables = ["socialcast"]
17
- s.extra_rdoc_files = [
18
- "LICENSE",
19
- "README.rdoc"
20
- ]
21
- s.files = [
22
- ".document",
23
- "LICENSE",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION",
27
- "bin/socialcast",
28
- "lib/socialcast.rb",
29
- "lib/socialcast/message.rb",
30
- "socialcast.gemspec",
31
- "test/commander_helper.rb",
32
- "test/helper.rb",
33
- "test/test_socialcast.rb"
34
- ]
35
- s.homepage = %q{http://github.com/wireframe/socialcast-command-line}
36
- s.require_paths = ["lib"]
37
- s.rubygems_version = %q{1.5.2}
38
- s.summary = %q{command line interface to socialcast api}
39
- s.test_files = [
40
- "test/commander_helper.rb",
41
- "test/helper.rb",
42
- "test/test_socialcast.rb"
43
- ]
44
14
 
45
- if s.respond_to? :specification_version then
46
- s.specification_version = 3
15
+ s.rubyforge_project = "socialcast"
16
+
17
+ s.add_development_dependency "shoulda", ">= 0"
18
+ s.add_runtime_dependency 'commander', '>= 4.0'
19
+ s.add_runtime_dependency 'rest-client', '>= 1.4.0'
20
+ s.add_runtime_dependency 'json', '>= 1.4.6'
21
+ s.add_runtime_dependency 'socialcast-api', '~> 0.0.2'
47
22
 
48
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
- s.add_development_dependency(%q<shoulda>, [">= 0"])
50
- s.add_runtime_dependency(%q<commander>, [">= 4.0"])
51
- s.add_runtime_dependency(%q<rest-client>, [">= 1.4.0"])
52
- s.add_runtime_dependency(%q<json>, [">= 1.4.6"])
53
- s.add_runtime_dependency(%q<activeresource>, [">= 2.3.5"])
54
- else
55
- s.add_dependency(%q<shoulda>, [">= 0"])
56
- s.add_dependency(%q<commander>, [">= 4.0"])
57
- s.add_dependency(%q<rest-client>, [">= 1.4.0"])
58
- s.add_dependency(%q<json>, [">= 1.4.6"])
59
- s.add_dependency(%q<activeresource>, [">= 2.3.5"])
60
- end
61
- else
62
- s.add_dependency(%q<shoulda>, [">= 0"])
63
- s.add_dependency(%q<commander>, [">= 4.0"])
64
- s.add_dependency(%q<rest-client>, [">= 1.4.0"])
65
- s.add_dependency(%q<json>, [">= 1.4.6"])
66
- s.add_dependency(%q<activeresource>, [">= 2.3.5"])
67
- end
23
+ s.files = `git ls-files`.split("\n")
24
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
+ s.require_paths = ["lib"]
68
27
  end
69
-
metadata CHANGED
@@ -1,22 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: socialcast
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 4
10
- version: 0.3.4
9
+ - 5
10
+ version: 0.3.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Sonnek
14
+ - Sean Cashin
14
15
  autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2011-02-23 00:00:00 -06:00
19
- default_executable: socialcast
19
+ date: 2011-03-22 00:00:00 -07:00
20
+ default_executable:
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
23
  name: shoulda
@@ -80,45 +81,47 @@ dependencies:
80
81
  type: :runtime
81
82
  version_requirements: *id004
82
83
  - !ruby/object:Gem::Dependency
83
- name: activeresource
84
+ name: socialcast-api
84
85
  prerelease: false
85
86
  requirement: &id005 !ruby/object:Gem::Requirement
86
87
  none: false
87
88
  requirements:
88
- - - ">="
89
+ - - ~>
89
90
  - !ruby/object:Gem::Version
90
- hash: 9
91
+ hash: 27
91
92
  segments:
93
+ - 0
94
+ - 0
92
95
  - 2
93
- - 3
94
- - 5
95
- version: 2.3.5
96
+ version: 0.0.2
96
97
  type: :runtime
97
98
  version_requirements: *id005
98
99
  description: publish messages to your stream from a command line interface
99
- email: ryan@socialcast.com
100
+ email:
101
+ - ryan@socialcast.com
100
102
  executables:
101
103
  - socialcast
102
104
  extensions: []
103
105
 
104
- extra_rdoc_files:
105
- - LICENSE
106
- - README.rdoc
106
+ extra_rdoc_files: []
107
+
107
108
  files:
108
109
  - .document
110
+ - .gitignore
111
+ - Gemfile
109
112
  - LICENSE
110
113
  - README.rdoc
111
114
  - Rakefile
112
- - VERSION
113
115
  - bin/socialcast
114
116
  - lib/socialcast.rb
115
117
  - lib/socialcast/message.rb
118
+ - lib/socialcast/version.rb
116
119
  - socialcast.gemspec
117
120
  - test/commander_helper.rb
118
121
  - test/helper.rb
119
122
  - test/test_socialcast.rb
120
123
  has_rdoc: true
121
- homepage: http://github.com/wireframe/socialcast-command-line
124
+ homepage: http://github.com/scashin133/socialcast-command-line
122
125
  licenses: []
123
126
 
124
127
  post_install_message:
@@ -146,8 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
149
  version: "0"
147
150
  requirements: []
148
151
 
149
- rubyforge_project:
150
- rubygems_version: 1.5.2
152
+ rubyforge_project: socialcast
153
+ rubygems_version: 1.6.1
151
154
  signing_key:
152
155
  specification_version: 3
153
156
  summary: command line interface to socialcast api
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.3.4