ntasks 0.0.1.alpha

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 16a1045e9b4f5e4ef78de3bd1616eeedfe55868a
4
+ data.tar.gz: da4e491798c6e8e1e64cb1711ec8350722137f38
5
+ SHA512:
6
+ metadata.gz: 17b0a2787c697cb0ddff756f71485705292ff036c0e9dd0b8b45ec269d73a276cb97002e53d164cb627cb058bef216c1c27473101e29d1dcab74d5df6831333e
7
+ data.tar.gz: 6ad871d99ec5b9f98e320a9a6923980142517f6bd7fccb261b14a3e9307aa14a489e7cb86c4360a84169ff0804ca363086f5b2029c9ca5c84b721ef51bbf9e57
@@ -0,0 +1,25 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+
24
+
25
+ .idea
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ntasks.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Stefano Germani
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.
@@ -0,0 +1,29 @@
1
+ # Ntasks
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'ntasks'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install ntasks
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/ntasks/fork )
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 a new Pull Request
@@ -0,0 +1,7 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new('spec')
5
+
6
+ # If you want to make this the default task
7
+ task :default => :spec
@@ -0,0 +1,9 @@
1
+ require 'ntasks/version'
2
+ require 'ntasks/tasks/nuget/pack/nuget_pack'
3
+ require 'ntasks/tasks/nuget/install/nuget_install'
4
+
5
+ module NTasks
6
+
7
+ end
8
+
9
+ self.extend NTasks::Nuget
@@ -0,0 +1,10 @@
1
+ class Cmd
2
+
3
+ def self.find_files(files)
4
+ FileList[files]
5
+ end
6
+
7
+ def self.execute(command)
8
+ system command
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ require 'ntasks/tasks/nuget/install/nuget_install_config'
2
+ require 'ntasks/tasks/nuget/install/nuget_install_task'
3
+
4
+ module NTasks::Nuget
5
+ def nuget_install(*args, &block)
6
+ Rake::Task.define_task args do
7
+ config = NugetInstallConfig.new
8
+
9
+ yield config
10
+
11
+ NugetInstallTask.new(config).execute
12
+ end
13
+ end
14
+ end
15
+
@@ -0,0 +1,5 @@
1
+ require 'ntasks/tasks/nuget/nuget_base_config'
2
+
3
+ class NugetInstallConfig < NugetBaseConfig
4
+ attr_accessor :package
5
+ end
@@ -0,0 +1,22 @@
1
+ require 'ntasks/tasks/nuget/nuget_base_task'
2
+
3
+ class NugetInstallTask < NugetBaseTask
4
+
5
+ def initialize(config)
6
+ super
7
+ raise ArgumentError, 'package not defined' if config.package.nil? || config.package.empty?
8
+ @config = config
9
+ end
10
+
11
+ def execute
12
+ Cmd.execute "#{@config.exe} install #{@config.package} #{options}"
13
+ end
14
+
15
+ private
16
+
17
+ def options
18
+ options = super
19
+
20
+ options
21
+ end
22
+ end
@@ -0,0 +1,8 @@
1
+ class NugetBaseConfig
2
+
3
+ attr_accessor :exe
4
+ attr_accessor :source
5
+
6
+ end
7
+
8
+
@@ -0,0 +1,12 @@
1
+ class NugetBaseTask
2
+ def initialize(config)
3
+ raise ArgumentError, 'exe not defined' if config.exe.nil? || config.exe.empty?
4
+ end
5
+
6
+ def options
7
+ options = ''
8
+ options << "-Source #{@config.source} " unless @config.source.nil? || @config.source.empty?
9
+
10
+ options
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ require 'rake'
2
+ require 'ntasks/tasks/nuget/pack/nuget_pack_task'
3
+ require 'ntasks/tasks/nuget/pack/nuget_pack_config'
4
+
5
+ module NTasks::Nuget
6
+
7
+ def nuget_pack(*args, &block)
8
+ Rake::Task.define_task args do
9
+ config = NugetPackConfig.new
10
+
11
+ yield config
12
+
13
+ NugetPackTask.new(config).execute
14
+ end
15
+ end
16
+
17
+ end
@@ -0,0 +1,6 @@
1
+ require 'ntasks/tasks/nuget/nuget_base_config'
2
+
3
+ class NugetPackConfig < NugetBaseConfig
4
+ attr_accessor :files
5
+ attr_accessor :version
6
+ end
@@ -0,0 +1,27 @@
1
+ require 'ntasks/tasks/nuget/nuget_base_task'
2
+
3
+ class NugetPackTask < NugetBaseTask
4
+ def initialize(config)
5
+ super
6
+
7
+ raise ArgumentError, 'files not defined' if config.files.nil? || config.files.empty?
8
+ @config = config
9
+ end
10
+
11
+ def execute
12
+ files = Cmd.find_files @config.files
13
+
14
+ files.each do |file|
15
+ Cmd.execute("#{@config.exe} pack #{file} #{options}")
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ def options
22
+ options = super
23
+ options << "-Version #{@config.version} " unless @config.version.nil? || @config.version.empty?
24
+
25
+ options
26
+ end
27
+ end
@@ -0,0 +1,3 @@
1
+ module NTasks
2
+ VERSION = '0.0.1.alpha'
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ntasks/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'ntasks'
8
+ spec.version = NTasks::VERSION
9
+ spec.authors = ['Stefano Germani']
10
+ spec.summary = 'Rake tasks for .NET'
11
+ #spec.description = %q{TODO: Write a longer description. Optional.}
12
+ spec.homepage = 'https://github.com/StefanoGermani/ntasks'
13
+ spec.license = 'MIT'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.6'
21
+ spec.add_development_dependency 'rspec', '~> 3.0.0'
22
+
23
+ spec.add_dependency 'rake', '>10' # this gem builds on rake
24
+ end
@@ -0,0 +1,8 @@
1
+ require 'bundler/setup'
2
+ Bundler.setup
3
+
4
+ Dir['./spec/support/**/*.rb'].each {|f| require f}
5
+
6
+ RSpec.configure do |config|
7
+ # some (optional) config here
8
+ end
@@ -0,0 +1,22 @@
1
+ require 'rspec'
2
+
3
+ shared_examples 'nuget exe nil or empty' do
4
+
5
+ context 'when exe property is nil' do
6
+ it 'raises an error' do
7
+ expect { subject }.to raise_error ArgumentError
8
+ end
9
+ end
10
+
11
+ context 'when exe property is empty' do
12
+ before { config.exe = '' }
13
+ it 'raises an error' do
14
+ expect { subject }.to raise_error ArgumentError
15
+ end
16
+ end
17
+
18
+ end
19
+
20
+ shared_examples 'source property' do
21
+
22
+ end
@@ -0,0 +1,40 @@
1
+ require 'rspec'
2
+
3
+ require 'ntasks'
4
+ require 'ntasks/cmd'
5
+
6
+ include NTasks::Nuget
7
+
8
+ describe NugetInstallTask do
9
+
10
+ let(:config) { NugetInstallConfig.new }
11
+ subject { NugetInstallTask.new(config) }
12
+
13
+ include_examples 'nuget exe nil or empty'
14
+
15
+ context 'when exe property is valid' do
16
+ before { config.exe = 'test.exe' }
17
+
18
+ context 'and package property is nil' do
19
+ it 'raises an error' do
20
+ expect { subject }.to raise_error ArgumentError
21
+ end
22
+ end
23
+
24
+ context 'and package property is empty' do
25
+ before { config.exe = '' }
26
+ it 'raises an error' do
27
+ expect { subject }.to raise_error ArgumentError
28
+ end
29
+ end
30
+
31
+ context 'and package property is valid' do
32
+ before { config.package = 'package' }
33
+
34
+ it 'execute the correct command' do
35
+ expect(Cmd).to receive(:execute).with('test.exe install package ')
36
+ subject.execute
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,64 @@
1
+ require 'rspec'
2
+ require 'ntasks'
3
+ require 'ntasks/cmd'
4
+
5
+ include NTasks::Nuget
6
+
7
+ describe NugetPackTask do
8
+
9
+ let(:config) { NugetPackConfig.new }
10
+ subject { NugetPackTask.new(config) }
11
+
12
+ include_examples 'nuget exe nil or empty'
13
+
14
+ context 'when exe property is valid' do
15
+ before { config.exe = 'test.exe' }
16
+
17
+ context 'and files property is nil' do
18
+ it 'raises an error' do
19
+ expect { subject }.to raise_error ArgumentError
20
+ end
21
+ end
22
+
23
+ context 'and files property is empty' do
24
+ before { config.files = '' }
25
+ it 'raises an error' do
26
+ expect { subject }.to raise_error ArgumentError
27
+ end
28
+ end
29
+
30
+ context 'and files property is valid' do
31
+ before do
32
+ config.files = 'file'
33
+ allow(Cmd).to receive(:find_files) { ['file'] }
34
+ end
35
+
36
+ it 'instance a task' do
37
+ expect(subject).to be_an_instance_of NugetPackTask
38
+ end
39
+
40
+ it 'execute the correct command' do
41
+ expect(Cmd).to receive(:execute).with('test.exe pack file ')
42
+ subject.execute
43
+ end
44
+
45
+ context 'when setting source property' do
46
+ before { config.source = 'source' }
47
+
48
+ it 'execute the correct command' do
49
+ expect(Cmd).to receive(:execute).with('test.exe pack file -Source source ')
50
+ subject.execute
51
+ end
52
+ end
53
+
54
+ context 'when setting version property' do
55
+ before { config.version = 'version' }
56
+
57
+ it 'execute the correct command' do
58
+ expect(Cmd).to receive(:execute).with('test.exe pack file -Version version ')
59
+ subject.execute
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ntasks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alpha
5
+ platform: ruby
6
+ authors:
7
+ - Stefano Germani
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 3.0.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">"
46
+ - !ruby/object:Gem::Version
47
+ version: '10'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">"
53
+ - !ruby/object:Gem::Version
54
+ version: '10'
55
+ description:
56
+ email:
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - ".gitignore"
62
+ - ".travis.yml"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - lib/ntasks.rb
68
+ - lib/ntasks/cmd.rb
69
+ - lib/ntasks/tasks/nuget/install/nuget_install.rb
70
+ - lib/ntasks/tasks/nuget/install/nuget_install_config.rb
71
+ - lib/ntasks/tasks/nuget/install/nuget_install_task.rb
72
+ - lib/ntasks/tasks/nuget/nuget_base_config.rb
73
+ - lib/ntasks/tasks/nuget/nuget_base_task.rb
74
+ - lib/ntasks/tasks/nuget/pack/nuget_pack.rb
75
+ - lib/ntasks/tasks/nuget/pack/nuget_pack_config.rb
76
+ - lib/ntasks/tasks/nuget/pack/nuget_pack_task.rb
77
+ - lib/ntasks/version.rb
78
+ - ntasks.gemspec
79
+ - spec/spec_helper.rb
80
+ - spec/support/nuget_base_config_spec.rb
81
+ - spec/tasks/nuget/nuget_install_task_spec.rb
82
+ - spec/tasks/nuget/nuget_pack_task_spec.rb
83
+ homepage: https://github.com/StefanoGermani/ntasks
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">"
99
+ - !ruby/object:Gem::Version
100
+ version: 1.3.1
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.0.3
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: Rake tasks for .NET
107
+ test_files:
108
+ - spec/spec_helper.rb
109
+ - spec/support/nuget_base_config_spec.rb
110
+ - spec/tasks/nuget/nuget_install_task_spec.rb
111
+ - spec/tasks/nuget/nuget_pack_task_spec.rb