magus 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +3 -0
- data/.simplecov +7 -0
- data/.travis.yml +5 -0
- data/.yardopts +8 -0
- data/Gemfile +28 -0
- data/Guardfile +23 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +69 -0
- data/cucumber.yml +6 -0
- data/features/configuration.feature +45 -0
- data/features/step_definitions/.gitkeep +0 -0
- data/features/support/env.rb +3 -0
- data/lib/magus.rb +11 -0
- data/lib/magus/version.rb +3 -0
- data/magus.gemspec +28 -0
- data/spec/magus_spec.rb +59 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/support/.gitkeep +0 -0
- metadata +142 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 798e3fe85c5dce3aa28ad408b0880cb955142441
|
4
|
+
data.tar.gz: 55e6a0df45d4708da6b164fb1936e4e27dad82b4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 68cfabcc5de13753477c4951c6a7657308b79a19100dca83e9f2d5af5b73ea50cea73400413ab2a19d3253a011584f2bb8e7318ad8166c33b24cd8fa453674ec
|
7
|
+
data.tar.gz: 6348ce7fe3993f63b6d2409bd8d92179ddd6a757be175f52c1a2d123489c593945e358171c25ffdea88183e76b331973088980064550ac64cbd5a89c66744618
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.simplecov
ADDED
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group :development, :test do
|
6
|
+
gem 'yard'
|
7
|
+
gem 'redcarpet'
|
8
|
+
gem 'guard-yard'
|
9
|
+
gem 'guard-bundler'
|
10
|
+
|
11
|
+
case RUBY_PLATFORM
|
12
|
+
when /darwin/i
|
13
|
+
gem 'terminal-notifier-guard', require: false
|
14
|
+
when /linux/i
|
15
|
+
gem 'libnotify', require: false
|
16
|
+
when /mswin|mingw/i
|
17
|
+
gem 'win32console', require: false
|
18
|
+
gem 'rb-notifu', require: false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
group :test do
|
23
|
+
gem 'rspec'
|
24
|
+
gem 'cucumber'
|
25
|
+
gem 'guard-rspec'
|
26
|
+
gem 'guard-cucumber'
|
27
|
+
gem 'simplecov', :require => false
|
28
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
guard 'bundler' do
|
2
|
+
watch('Gemfile')
|
3
|
+
watch(%r{^.+\.gemspec$})
|
4
|
+
end
|
5
|
+
|
6
|
+
guard 'cucumber', rvm: ['1.9.3@magus', '2.0.0@magus'], cli: '--profile guard', run_all: {cli: "--profile all"}, all_on_start: true, all_after_pass: false do
|
7
|
+
watch(%r{^features/.+\.feature$})
|
8
|
+
watch(%r{^features/support/.+$}) { 'features' }
|
9
|
+
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
10
|
+
end
|
11
|
+
|
12
|
+
guard 'rspec', rvm: ['1.9.3@magus', '2.0.0@magus'], run_all: {cli: '--format progress'}, all_on_start: true, all_after_pass: false do
|
13
|
+
watch(%r{^spec/.+_spec\.rb$})
|
14
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
15
|
+
watch('spec/spec_helper.rb') { "spec" }
|
16
|
+
end
|
17
|
+
|
18
|
+
guard 'yard', stdout: '/dev/null', stderr: '/dev/null' do
|
19
|
+
watch(%r{lib/.+\.rb})
|
20
|
+
watch('README.md')
|
21
|
+
watch('LICENSE')
|
22
|
+
watch('.yardopts')
|
23
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Dave Nunez
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Magus
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'magus'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install magus
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require 'cucumber/rake/task'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
require 'magus/version'
|
5
|
+
|
6
|
+
Cucumber::Rake::Task.new(:features)
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
|
9
|
+
task :test => [:features, :spec]
|
10
|
+
task :default => :test
|
11
|
+
|
12
|
+
desc "Display current gem version"
|
13
|
+
task :version do
|
14
|
+
puts "Current Version: #{Magento::VERSION}"
|
15
|
+
end
|
16
|
+
|
17
|
+
namespace :version do
|
18
|
+
desc "Bump version (defaults to patch)"
|
19
|
+
task :bump => "bump:patch"
|
20
|
+
|
21
|
+
namespace :bump do
|
22
|
+
desc "Bump major version"
|
23
|
+
task :major => :version do |t|
|
24
|
+
bump_version(task_tail(t))
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "Bump minor version"
|
28
|
+
task :minor => :version do |t|
|
29
|
+
bump_version(task_tail(t))
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Bump patch version"
|
33
|
+
task :patch => :version do |t|
|
34
|
+
bump_version(task_tail(t))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def split_task_name(task)
|
40
|
+
task.name.split(":")
|
41
|
+
end
|
42
|
+
|
43
|
+
def task_tail(task)
|
44
|
+
split_task_name(task).last
|
45
|
+
end
|
46
|
+
|
47
|
+
def bump_version(segment)
|
48
|
+
segments = Magento::VERSION.split(".").map(&:to_i)
|
49
|
+
|
50
|
+
case segment
|
51
|
+
when "major"
|
52
|
+
segments[0] += 1
|
53
|
+
segments[1] = 0
|
54
|
+
segments[2] = 0
|
55
|
+
when "minor"
|
56
|
+
segments[1] += 1
|
57
|
+
segments[2] = 0
|
58
|
+
when "patch"
|
59
|
+
segments[2] += 1
|
60
|
+
end
|
61
|
+
|
62
|
+
new_version = segments.join(".")
|
63
|
+
|
64
|
+
file = File.expand_path("../lib/magus/version.rb", __FILE__)
|
65
|
+
new_text = File.read(file).gsub(Magento::VERSION, new_version)
|
66
|
+
File.open(file, 'w') {|f| f.puts new_text}
|
67
|
+
|
68
|
+
puts "New version: #{new_version}"
|
69
|
+
end
|
data/cucumber.yml
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
Feature: Configuration
|
2
|
+
|
3
|
+
Configure the Magento gem using the configure block syntax
|
4
|
+
or configure each option directly.
|
5
|
+
|
6
|
+
|
7
|
+
Scenario Outline: Configure directly
|
8
|
+
Given a file named "configuration.rb" with:
|
9
|
+
"""
|
10
|
+
require 'magus'
|
11
|
+
|
12
|
+
<attribute> = "<value>"
|
13
|
+
print <attribute>
|
14
|
+
"""
|
15
|
+
When I run `ruby configuration.rb`
|
16
|
+
Then the output should contain exactly "<value>"
|
17
|
+
And the exit status should be 0
|
18
|
+
|
19
|
+
Examples:
|
20
|
+
| attribute | value |
|
21
|
+
| Magento.endpoint | http://www.example.com/api/soap |
|
22
|
+
| Magento.username | jdoe |
|
23
|
+
| Magento.api_key | password |
|
24
|
+
|
25
|
+
|
26
|
+
Scenario Outline: Configure with block syntax
|
27
|
+
Given a file named "configuration.rb" with:
|
28
|
+
"""
|
29
|
+
require 'magus'
|
30
|
+
|
31
|
+
Magento.configure do |c|
|
32
|
+
<option> = "<value>"
|
33
|
+
end
|
34
|
+
|
35
|
+
print <attribute>
|
36
|
+
"""
|
37
|
+
When I run `ruby configuration.rb`
|
38
|
+
Then the output should contain exactly "<value>"
|
39
|
+
And the exit status should be 0
|
40
|
+
|
41
|
+
Examples:
|
42
|
+
| option | attribute | value |
|
43
|
+
| c.endpoint | Magento.endpoint | http://www.example.com/api/soap |
|
44
|
+
| c.username | Magento.username | jdoe |
|
45
|
+
| c.api_key | Magento.api_key | password |
|
File without changes
|
data/lib/magus.rb
ADDED
data/magus.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'magus/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "magus"
|
8
|
+
spec.version = Magento::VERSION
|
9
|
+
spec.authors = ["Dave Nunez"]
|
10
|
+
spec.email = ["dnunez24@gmail.com"]
|
11
|
+
spec.description = %q{Magento API wrapper in Ruby}
|
12
|
+
spec.summary = %q{An easy-to-use Ruby wrapper for all the Magento core API types (XML-RPC, SOAP, REST)}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.rubyforge_project = "magus"
|
16
|
+
spec.required_ruby_version = ">= 1.9.3"
|
17
|
+
|
18
|
+
spec.files = `git ls-files`.split($/)
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
25
|
+
spec.add_development_dependency "rspec", "~> 2.14"
|
26
|
+
spec.add_development_dependency "cucumber", "~> 1.3"
|
27
|
+
spec.add_development_dependency "aruba", "~> 0.5"
|
28
|
+
end
|
data/spec/magus_spec.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Magento
|
4
|
+
describe Magento, ".configure" do
|
5
|
+
context "when a block is given" do
|
6
|
+
it "yields the Magento module" do
|
7
|
+
expect { |config| Magento.configure(&config) }.to yield_with_args Magento
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
context "when no block is given" do
|
12
|
+
it "returns nothing" do
|
13
|
+
expect(Magento.configure).to eq nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe Magento, ".endpoint" do
|
19
|
+
let(:url) { "http://www.example.com/api/soap" }
|
20
|
+
|
21
|
+
it "can be set directly" do
|
22
|
+
Magento.endpoint = url
|
23
|
+
expect(Magento.endpoint).to eq url
|
24
|
+
end
|
25
|
+
|
26
|
+
it "can be set from the configuration block" do
|
27
|
+
Magento.configure {|c| c.endpoint = url}
|
28
|
+
expect(Magento.endpoint).to eq url
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe Magento, ".username" do
|
33
|
+
let(:user) { "jdoe" }
|
34
|
+
|
35
|
+
it "can be set directly" do
|
36
|
+
Magento.username = user
|
37
|
+
expect(Magento.username).to eq user
|
38
|
+
end
|
39
|
+
|
40
|
+
it "can be set from the configuration block" do
|
41
|
+
Magento.configure {|c| c.username = user}
|
42
|
+
expect(Magento.username).to eq user
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe Magento, ".api_key" do
|
47
|
+
let(:api_key) { "password" }
|
48
|
+
|
49
|
+
it "can be set directly" do
|
50
|
+
Magento.api_key = api_key
|
51
|
+
expect(Magento.api_key).to eq api_key
|
52
|
+
end
|
53
|
+
|
54
|
+
it "can be set from the configuration block" do
|
55
|
+
Magento.configure {|c| c.api_key = api_key}
|
56
|
+
expect(Magento.api_key).to eq api_key
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'magus'
|
3
|
+
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each { |f| require f }
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
config.expect_with :rspec do |c|
|
7
|
+
c.syntax = :expect
|
8
|
+
end
|
9
|
+
config.mock_with :rspec do |c|
|
10
|
+
c.syntax = :expect
|
11
|
+
end
|
12
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
|
+
config.run_all_when_everything_filtered = true
|
14
|
+
config.filter_run :focus
|
15
|
+
config.order = 'random'
|
16
|
+
end
|
17
|
+
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: magus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dave Nunez
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.14'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.14'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: cucumber
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.3'
|
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.5'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.5'
|
83
|
+
description: Magento API wrapper in Ruby
|
84
|
+
email:
|
85
|
+
- dnunez24@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- .rspec
|
92
|
+
- .simplecov
|
93
|
+
- .travis.yml
|
94
|
+
- .yardopts
|
95
|
+
- Gemfile
|
96
|
+
- Guardfile
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- cucumber.yml
|
101
|
+
- features/configuration.feature
|
102
|
+
- features/step_definitions/.gitkeep
|
103
|
+
- features/support/env.rb
|
104
|
+
- lib/magus.rb
|
105
|
+
- lib/magus/version.rb
|
106
|
+
- magus.gemspec
|
107
|
+
- spec/magus_spec.rb
|
108
|
+
- spec/spec_helper.rb
|
109
|
+
- spec/support/.gitkeep
|
110
|
+
homepage: ''
|
111
|
+
licenses:
|
112
|
+
- MIT
|
113
|
+
metadata: {}
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options: []
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 1.9.3
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
requirements: []
|
129
|
+
rubyforge_project: magus
|
130
|
+
rubygems_version: 2.0.3
|
131
|
+
signing_key:
|
132
|
+
specification_version: 4
|
133
|
+
summary: An easy-to-use Ruby wrapper for all the Magento core API types (XML-RPC,
|
134
|
+
SOAP, REST)
|
135
|
+
test_files:
|
136
|
+
- features/configuration.feature
|
137
|
+
- features/step_definitions/.gitkeep
|
138
|
+
- features/support/env.rb
|
139
|
+
- spec/magus_spec.rb
|
140
|
+
- spec/spec_helper.rb
|
141
|
+
- spec/support/.gitkeep
|
142
|
+
has_rdoc:
|