xpm 0.0.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 24e4b4deb327fb6d2d40e6e2ea9832a8167d1104
4
+ data.tar.gz: bad9299dbc01bfa3d5f8ab1894f2f9ea0659842c
5
+ SHA512:
6
+ metadata.gz: 5e21c8fea58834f092beb533e04cd0825555ce77653217838720b19e25a9b2a088879ea70089cf0d4b1bb39aaf1492421a198055a95d6f9488c1a45b69ccb6da
7
+ data.tar.gz: ad252c909a4e086c7ba207848d724d3c92204f151ea08153eee397129437952ecf6dfae936d04ddf95617295aeaec7360388ec59afd98ccdbf03d5528d1fa1d9
data/.gitignore ADDED
@@ -0,0 +1,22 @@
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
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in xpm.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 msimonin
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
+ # Xpm
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'xpm'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install xpm
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/xpm/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
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/xpm ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "thor"
4
+ require "xpm"
5
+
6
+ class XpmCli < Thor
7
+
8
+ desc "new [NAME]", "Create a new project called NAME in the current directory"
9
+ option :packages
10
+ def new(name)
11
+ xp = XPM::XP.new()
12
+ xp.new(name, :packages => options[:packages])
13
+ end
14
+
15
+ desc "install", "install a package locally"
16
+ def install(package=nil)
17
+ xp = XPM::XP.new()
18
+ xp.install(package)
19
+ end
20
+
21
+ end
22
+
23
+ XpmCli.start(ARGV)
@@ -0,0 +1,3 @@
1
+ module Xpm
2
+ VERSION = "0.0.1"
3
+ end
data/lib/xpm/xp.rb ADDED
@@ -0,0 +1,88 @@
1
+ require 'open-uri'
2
+ require 'zlib'
3
+ require 'open3'
4
+ require 'logger'
5
+ require 'json'
6
+ require 'fileutils'
7
+
8
+ module XPM
9
+ class XP
10
+
11
+
12
+ def initialize(options = {})
13
+ @logger = options[:logger] || Logger.new(STDOUT)
14
+ end
15
+
16
+ def new(name, *args)
17
+ tarball = "master.tar.gz"
18
+ url = "https://github.com/capi5k/capi5k-init/tarball/master"
19
+
20
+ @logger.info "Downloading project skeleton"
21
+ # begin / rescue...
22
+ open(tarball, 'w') do |local_file|
23
+ open(url) do |remote_file|
24
+ local_file.write(Zlib::GzipReader.new(remote_file).read)
25
+ end
26
+ end
27
+
28
+ cmd = 'tar -xvzf master.tar.gz'
29
+ Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
30
+ @logger.info "Extracting project skeleton"
31
+ err = stderr.read
32
+ @logger.error err unless err.empty?
33
+ end
34
+
35
+ FileUtils.rm tarball
36
+
37
+ temp= %r{.*capi5k-init.*}
38
+ all_files = Dir.glob("*")
39
+ my_files = all_files.grep(temp)
40
+
41
+ if my_files.length != 1
42
+ puts "error"
43
+ else
44
+ FileUtils.mv my_files[0], name
45
+ end
46
+ @logger.info "New project initialized"
47
+
48
+ end # init
49
+
50
+ def install(package = nil)
51
+
52
+ # TODO @depmanager.preinstall ?
53
+
54
+ cmd = 'bower install ' + package.to_s
55
+ # TODO abstract this (@depmanager.install)
56
+ Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
57
+ @logger.info "installing dependencies"
58
+ @logger.info stdout.read
59
+ err = stderr.read
60
+ @logger.error err unless err.empty?
61
+ end
62
+
63
+ # TODO hook postinstall (@depmanager.postinstall)
64
+ # for now loop over bower_components/* and export
65
+ # files to ./exports/<module name>/.
66
+ mpath = "bower_components"
67
+ bowers = Dir.glob("#{mpath}/*");
68
+
69
+ # TODO rescue
70
+ bowers.each do |bower|
71
+ desc = File.read(File.join(bower, "bower.json"))
72
+ desc = JSON.parse(desc)
73
+ mname = File.basename(bower)
74
+ destination_directory = File.join("exports", mname, ".")
75
+ exports = desc["exports"]
76
+ @logger.debug exports
77
+ exports.each do |export|
78
+ source_file = File.join(bower, export)
79
+ FileUtils.mkdir_p destination_directory
80
+ FileUtils.cp source_file, destination_directory
81
+ end unless exports.nil?
82
+ end
83
+
84
+ end # install
85
+
86
+ end
87
+ end
88
+
data/lib/xpm.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "xpm/version"
2
+ require "xpm/xp"
3
+
4
+ module Xpm
5
+ end
data/xpm.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xpm/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "xpm"
8
+ spec.version = Xpm::VERSION
9
+ spec.authors = ["msimonin"]
10
+ spec.email = ["matthieu.simonin@inria.fr"]
11
+ spec.summary = "xpm is a command line tool to control capi5k"
12
+ spec.description = "xpm is a command line tool to control capi5k."
13
+ spec.homepage = "https://capi5k.github.io/capi5k"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency('thor', '~> 0.19')
22
+ spec.add_runtime_dependency('json', '~> 1.8')
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.6"
25
+
26
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xpm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - msimonin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.19'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.19'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ description: xpm is a command line tool to control capi5k.
56
+ email:
57
+ - matthieu.simonin@inria.fr
58
+ executables:
59
+ - xpm
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/xpm
69
+ - lib/xpm.rb
70
+ - lib/xpm/version.rb
71
+ - lib/xpm/xp.rb
72
+ - xpm.gemspec
73
+ homepage: https://capi5k.github.io/capi5k
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.2.2
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: xpm is a command line tool to control capi5k
97
+ test_files: []