vam 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: 54e20378bacb703c990dee6edc0e83cc51121830
4
+ data.tar.gz: b878b7f115dd51929b20678337d537d7e4944daa
5
+ SHA512:
6
+ metadata.gz: 75d4da1827419cc537666c2bf510eec6fa04a32fa8f9d20f0ffb57186c36cbee0579c65a91243eceaac8527a48b6f2c38b3a371efdbebf3c85394d52e52ce713
7
+ data.tar.gz: 624b406481e53697b89a3c1794cfeb57de5bc33fe588e9bb8eaacfeefd43b1422e3412c1880113a4d94f481ad76863cb7c6d47db6b1cb50a33ef0a70438337f5
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
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
+ </project>
5
+
data/.idea/misc.xml ADDED
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.1.1" project-jdk-type="RUBY_SDK" />
4
+ </project>
5
+
data/.idea/modules.xml ADDED
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/vam.iml" filepath="$PROJECT_DIR$/.idea/vam.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
9
+
@@ -0,0 +1,5 @@
1
+ <component name="DependencyValidationManager">
2
+ <state>
3
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
4
+ </state>
5
+ </component>
data/.idea/vam.iml ADDED
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="FacetManager">
4
+ <facet type="gem" name="Ruby Gem">
5
+ <configuration>
6
+ <option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
7
+ <option name="GEM_APP_TEST_PATH" value="$MODULE_DIR$/test" />
8
+ <option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
9
+ </configuration>
10
+ </facet>
11
+ </component>
12
+ <component name="NewModuleRootManager">
13
+ <content url="file://$MODULE_DIR$">
14
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
15
+ </content>
16
+ <orderEntry type="jdk" jdkName="rbenv: 2.1.1" jdkType="RUBY_SDK" />
17
+ <orderEntry type="sourceFolder" forTests="false" />
18
+ <orderEntry type="module-library">
19
+ <library name="vam (v0.0.1, /wrd/prj/vam) [path][gem]">
20
+ <CLASSES>
21
+ <root url="file://$MODULE_DIR$/bin" />
22
+ <root url="file://$MODULE_DIR$/lib" />
23
+ <root url="file://$MODULE_DIR$/.idea" />
24
+ </CLASSES>
25
+ <SOURCES>
26
+ <root url="file://$MODULE_DIR$/bin" />
27
+ <root url="file://$MODULE_DIR$/lib" />
28
+ <root url="file://$MODULE_DIR$/.idea" />
29
+ </SOURCES>
30
+ </library>
31
+ </orderEntry>
32
+ <orderEntry type="library" scope="PROVIDED" name="colorize (v0.7.3, rbenv: 2.1.1) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.3.1, rbenv: 2.1.1) [gem]" level="application" />
34
+ </component>
35
+ </module>
36
+
data/.idea/vcs.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="" />
5
+ </component>
6
+ </project>
7
+
@@ -0,0 +1,56 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <option name="TRACKING_ENABLED" value="true" />
5
+ <option name="SHOW_DIALOG" value="false" />
6
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
7
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
8
+ <option name="LAST_RESOLUTION" value="IGNORE" />
9
+ </component>
10
+ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
11
+ <component name="CreatePatchCommitExecutor">
12
+ <option name="PATCH_PATH" value="" />
13
+ </component>
14
+ <component name="DaemonCodeAnalyzer">
15
+ <disable_hints />
16
+ </component>
17
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
18
+ <OptionsSetting value="true" id="Add" />
19
+ <OptionsSetting value="true" id="Remove" />
20
+ <OptionsSetting value="true" id="Checkout" />
21
+ <OptionsSetting value="true" id="Update" />
22
+ <OptionsSetting value="true" id="Status" />
23
+ <OptionsSetting value="true" id="Edit" />
24
+ <ConfirmationsSetting value="0" id="Add" />
25
+ <ConfirmationsSetting value="0" id="Remove" />
26
+ </component>
27
+ <component name="ProjectReloadState">
28
+ <option name="STATE" value="0" />
29
+ </component>
30
+ <component name="PropertiesComponent">
31
+ <property name="options.lastSelected" value="org.jetbrains.plugins.ruby.settings.RubyModuleStructureConfigurable" />
32
+ <property name="options.splitter.main.proportions" value="0.3" />
33
+ <property name="options.splitter.details.proportions" value="0.2" />
34
+ <property name="options.searchVisible" value="true" />
35
+ </component>
36
+ <component name="RunManager">
37
+ <list size="0" />
38
+ </component>
39
+ <component name="ShelveChangesManager" show_recycled="false" />
40
+ <component name="TaskManager">
41
+ <task active="true" id="Default" summary="Default task" />
42
+ <servers />
43
+ </component>
44
+ <component name="VcsContentAnnotationSettings">
45
+ <option name="myLimit" value="2678400000" />
46
+ </component>
47
+ <component name="VcsManagerConfiguration">
48
+ <option name="myTodoPanelSettings">
49
+ <TodoPanelSettings />
50
+ </option>
51
+ </component>
52
+ <component name="XDebuggerManager">
53
+ <breakpoint-manager />
54
+ </component>
55
+ </project>
56
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vam.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Xingjian Xu
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
+ # Vam
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'vam'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install vam
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/vam/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/vam ADDED
@@ -0,0 +1,9 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'vam'
4
+
5
+ Vam::CLI.start(ARGV)
6
+
7
+
8
+
9
+
data/lib/vam.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'vam/cli'
2
+ require 'vam/dsl'
3
+ require 'vam/version'
4
+
5
+
6
+ module Vam
7
+
8
+
9
+ end
data/lib/vam/cli.rb ADDED
@@ -0,0 +1,29 @@
1
+ require 'vam/constants'
2
+ require 'vam/dsl'
3
+
4
+ module Vam
5
+ class CLI
6
+
7
+ def self.start(argv)
8
+ Dir.mkdir VAMROOT unless File.directory? VAMROOT
9
+ if argv.length >0 and argv[0] == 'install'
10
+ install
11
+ end
12
+ end
13
+
14
+
15
+ def self.install
16
+ vamfile = File.join Dir.pwd, 'Vamfile'
17
+ vams = Dsl.evaluate vamfile, vamfile+'.lock'
18
+
19
+ for vam in vams
20
+ dest = File.join(Dir.pwd, 'vendor', 'assets', 'components')
21
+ vam.install dest
22
+ end
23
+
24
+ end
25
+
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,3 @@
1
+ module Vam
2
+ VAMROOT = File.expand_path '~/.vam'
3
+ end
data/lib/vam/dsl.rb ADDED
@@ -0,0 +1,38 @@
1
+ require 'vam/vam'
2
+
3
+ module Vam
4
+ class Dsl
5
+
6
+ attr_reader :vams
7
+
8
+ def self.evaluate(vamfile, lockfile)
9
+ dsl = new()
10
+ dsl.eval_vamfile(vamfile)
11
+ return dsl.vams
12
+ end
13
+
14
+
15
+ def initialize
16
+ @vams = []
17
+ end
18
+
19
+
20
+ def eval_vamfile(vamfile, contents = nil)
21
+ contents ||= File.read(vamfile)
22
+ instance_eval(contents, vamfile.to_s, 1)
23
+ end
24
+
25
+
26
+ def vam(name, *args, &block)
27
+ options = args.last.is_a?(Hash) ? args.last.dup : {}
28
+
29
+ if args.first.is_a?(String)
30
+ options[:version] = args.first
31
+ end
32
+
33
+ vam = Vam.new name, options, &block
34
+ @vams << vam
35
+ end
36
+
37
+ end
38
+ end
data/lib/vam/vam.rb ADDED
@@ -0,0 +1,93 @@
1
+ require 'fileutils'
2
+ require 'colorize'
3
+ require 'vam/constants'
4
+
5
+ module Vam
6
+
7
+ class Vam
8
+
9
+ def initialize(name, options, &block)
10
+ @name = name
11
+
12
+ @tmproot = "#{VAMROOT}/#{@name}"
13
+
14
+ @urls = []
15
+ @locals = []
16
+
17
+ if options.include?(:version)
18
+ @version = options[:version]
19
+ elsif options.include?(:github)
20
+ @git = "https://github.com/#{options[:github]}.git"
21
+ else
22
+ @git = options[:git]
23
+ end
24
+
25
+ instance_eval &block
26
+
27
+ end
28
+
29
+
30
+ def url(url, main: false)
31
+ filename = main ? 'index'+File.extname(url) : File.basename(url)
32
+ @urls << {url: url, filename: filename}
33
+ end
34
+
35
+
36
+ def local(local, main: false)
37
+ filename = main ? 'index'+File.extname(local): File.basename(local)
38
+ @locals << {local: local, filename: filename}
39
+ end
40
+
41
+
42
+ def install(dest)
43
+ puts "===Install #{@name}===".colorize(:blue)
44
+
45
+ dest = File.join dest, @name
46
+ FileUtils.mkdir_p dest unless File.exist? dest
47
+
48
+ if @git
49
+ clone_git @git
50
+
51
+ for local in @locals
52
+ install_local dest, local, @tmproot
53
+ end
54
+
55
+ end
56
+
57
+ for url in @urls
58
+ install_url dest, url
59
+ end
60
+
61
+ end
62
+
63
+
64
+ def install_local(dest, local, root)
65
+ local_path = File.join root, local[:local]
66
+
67
+ if File.directory? local_path
68
+ for f in Dir.glob File.join(local_path, '*')
69
+ FileUtils.cp_r f, dest
70
+ end
71
+ else
72
+ FileUtils.cp local_path, File.join(dest, local[:filename])
73
+ end
74
+ end
75
+
76
+
77
+ def clone_git(git)
78
+ if File.directory? @tmproot
79
+ `cd #{@tmproot};git pull`
80
+ else
81
+ `git clone --depth=1 #{git} #{@tmproot}`
82
+ end
83
+
84
+ end
85
+
86
+
87
+ def install_url(dest, url)
88
+ `wget #{url[:url]} -O #{File.join dest, url[:filename]}`
89
+ end
90
+
91
+
92
+ end
93
+ end
@@ -0,0 +1,3 @@
1
+ module Vam
2
+ VERSION = "0.0.1"
3
+ end
data/vam.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vam/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vam"
8
+ spec.version = Vam::VERSION
9
+ spec.authors = ["Xingjian Xu"]
10
+ spec.email = ["dotswing@gmail.com"]
11
+ spec.summary = %q{Vendor assets managment}
12
+ spec.description = %q{Vendor assets managment tool}
13
+ spec.homepage = "http://github.com/dotswing/vam"
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_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake", "~> 10.1"
23
+
24
+ spec.add_runtime_dependency 'colorize', "~> 0.7"
25
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vam
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Xingjian Xu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-28 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: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: colorize
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.7'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.7'
55
+ description: Vendor assets managment tool
56
+ email:
57
+ - dotswing@gmail.com
58
+ executables:
59
+ - vam
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".idea/encodings.xml"
65
+ - ".idea/misc.xml"
66
+ - ".idea/modules.xml"
67
+ - ".idea/scopes/scope_settings.xml"
68
+ - ".idea/vam.iml"
69
+ - ".idea/vcs.xml"
70
+ - ".idea/workspace.xml"
71
+ - Gemfile
72
+ - LICENSE.txt
73
+ - README.md
74
+ - Rakefile
75
+ - bin/vam
76
+ - lib/vam.rb
77
+ - lib/vam/cli.rb
78
+ - lib/vam/constants.rb
79
+ - lib/vam/dsl.rb
80
+ - lib/vam/vam.rb
81
+ - lib/vam/version.rb
82
+ - vam.gemspec
83
+ homepage: http://github.com/dotswing/vam
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: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.2.2
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: Vendor assets managment
107
+ test_files: []